-
-
Save seungjin/2d29f85572ce91d171c5fd697b817c7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env julia | |
count = Dict() | |
for line in eachline(stdin) | |
for word in split(line) | |
if haskey(count,word) | |
count[word] += 1 | |
else | |
count[word] = 1 | |
end | |
end | |
end | |
for e in sort(collect(count), by=x->x[2], rev=true) | |
println( first(e), " " , last(e) ) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment