// uses https://github.com/martinus/robin-hood-hashing #include #include #include #include "robin_hood.h" #include using namespace std; int main() { std::ios::sync_with_stdio(false); string s; robin_hood::unordered_map count; while (cin >> s) count[s]++; vector> temp(count.begin(), count.end()); sort(temp.begin(), temp.end(), [](auto const& a,auto const& b) { return b.second < a.second; } ); for (std::size_t i = 0; i < temp.size(); ++i) cout << temp[i].second << " " << temp[i].first << "\n"; }