Skip to content

Instantly share code, notes, and snippets.

@funny-falcon
Created October 20, 2017 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funny-falcon/0f61703123f56e35b8f4c9a66c8f13cc to your computer and use it in GitHub Desktop.
Save funny-falcon/0f61703123f56e35b8f4c9a66c8f13cc to your computer and use it in GitHub Desktop.
h = {} of UInt64 => Array(String)
STDIN.each_line do |line|
line = line.chomp
hv = line.hash
if h.has_key?(hv)
ar = h[hv]
unless ar.includes?(line)
ar.push(line)
end
else
h[hv] = [line]
end
end
h.each do |hv, ar|
if ar.size > 1
puts hv
p ar
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment