Skip to content

Latest commit

 

History

History
4 lines (3 loc) · 290 Bytes

11.21.md

File metadata and controls

4 lines (3 loc) · 290 Bytes
while (cin >> word)
  ++word_count.insert({word, 0}).first->second;

The code just does the same thing as ++word_count[word];. If the word is in map, then increase the count of that word by 1, else insert that word into map, set the count to 0, and increase the count by 1.