#include #include #include #include using namespace std; bool compare(std::pair const & a, std::pair const & b) { return b.second < a.second; } int main() { std::ios::sync_with_stdio(false); string s; tr1::unordered_map count; while (cin >> s) { count[s]++; } vector > temp(count.begin(), count.end()); sort(temp.begin(), temp.end(), compare); for (std::size_t i = 0; i < temp.size(); ++i) cout << temp[i].second << " " << temp[i].first << "\n"; }