Advertisement
kevobo2599

Untitled

Mar 28th, 2020
3,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.23 KB | None | 0 0
  1. import tables, strutils
  2.  
  3. var wordFrequencies = initCountTable[string]()
  4.  
  5. for line in stdin.lines:
  6.   for word in line.split(", "):
  7.     wordFrequencies.inc(word)
  8.  
  9. echo "The most frequent word is '", wordFrequencies.largest, "'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement