accelerated c++(和訳版)に載っていた入力単語の登場回数を数えるサンプルコードなのですが、
コンパイルは成功するのですが実行しても意図した動作をしません。
恐らく無限ループになっています。
何度か見直して、ちゃんと本の通りになっていると思うのですが・・・何処がダメなのでしょうか?
int main(){
string s;
map <string,int> counters;
while (cin >> s)
++counters[s];
for (map<string,int>::const_iterator it = counters.begin();it != counters.end(); ++it){
cout << it->first << "\t" << it->second << endl;
}
return 0;
}