#include <iostream>
#include <string>
#include <map>
#include <fstream>
using namespace std;
int main()
{
map<string, int> hist;
ifstream in( "inFile" );
string word;
while ( in >> word )
hist[ word ]++;
in.close();
typedef map<string, int>::const_iterator CI;
for ( CI iter = hist.begin(); iter != hist.end(); ++iter )
cout << iter->first << '\t' << iter->second << endl;
return 0;
}
|