Created
November 5, 2012 15:21
-
-
Save mike-zhang/4017738 to your computer and use it in GitHub Desktop.
STL map test : word count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
map<string,int> dict; | |
string word; | |
while(cin>>word) | |
cout<<++dict[word]<<endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment