RosettaCodeData/Task/Longest-string-challenge/Ruby/longest-string-challenge-2.rb

3 lines
61 B
Ruby

h = $stdin.group_by(&:size)
puts h.max.last unless h.empty?