Skip to content

Commit

Permalink
Simplify example (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
meatball133 authored Oct 14, 2023
1 parent afa4cde commit 78ba217
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions exercises/practice/word-count/.meta/src/example.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78ba217

Please sign in to comment.