/* Copyright (C) 1999 Lucent Technologies */ /* From 'Programming Pearls' by Jon Bentley */ /* wordfreq.cpp -- List all words in input file, with counts */ #include #include #include using namespace std; int main() { map M; map::iterator j; string t; while (cin >> t) M[t]++; for (j = M.begin(); j != M.end(); ++j) cout << j->first << " " << j->second << "\n"; return 0; }