summaryrefslogtreecommitdiff
path: root/key-count
blob: deaa522677aff30bed45b3e65620668a708a5955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env ruby

STDIN.set_encoding 'utf-8'
STDOUT.set_encoding 'utf-8'

h = {}
h.default = 0
while line = STDIN.gets
  line.strip!
  h[line] += 1
end

h.each_pair { |k,v| puts "#{k} #{v}" }