diff --git a/content/index.md b/content/index.md index 0b4d3ef..32818f0 100644 --- a/content/index.md +++ b/content/index.md @@ -11,18 +11,18 @@ Getting started? Head over to the [installation instructions](/getting_started/) ``` nimrod import tables, strutils -var wordFrequencies = initTable[string, int] +var wordFrequencies = initTable[string, int]() for line in stdin.lines: for word in line.split(", "): - wordFrequencies[word] += 1 + wordFrequencies[word] = wordFrequencies[word] + 1 -var maxFrequency = 0 +var maxFrequency = 0 var mostFrequentWord: string for word, frequency in wordFrequencies: if frequency > maxFrequency: maxFrequency = frequency mostFrequentWord = word -echo "The most frequent word is '", word, "'" +echo "The most frequent word is '", mostFrequentWord, "'" ``` \ No newline at end of file