diff --git a/exercises/practice/word-count/.meta/src/example.cr b/exercises/practice/word-count/.meta/src/example.cr index cb724b92..f43beac7 100644 --- a/exercises/practice/word-count/.meta/src/example.cr +++ b/exercises/practice/word-count/.meta/src/example.cr @@ -3,9 +3,7 @@ module WordCount result = Hash(String, Int32).new sentence.split(/[\t, \s, \n,]+/).each do |word| word = word.downcase.gsub(/[^\w\s']/, "").gsub(/^\'+|\'+$/, "") - if word == "" - next - end + next if word.empty? result[word] = result.has_key?(word) ? result[word] + 1 : 1 end result