Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 13 lines (12 sloc) 322 Bytes
#!/usr/bin/env ruby
last_key, max_val = nil, 0
STDIN.each_line do |line|
key, val = line.split("\t")
if last_key && last_key != key
puts "#{last_key}\t#{max_val}"
last_key, max_val = key, val.to_i
else
last_key, max_val = key, [max_val, val.to_i].max
end
end
puts "#{last_key}\t#{max_val}" if last_key
Something went wrong with that request. Please try again.