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

18 lines
171 B
Ruby

# Without restrictions
BEGIN {
v = [ ]
m = 0
}
n = $_.length
if n == m then
v <<= $_
elsif n > m then
v = [$_]
m = n
end
END {
v.each { |s| puts s }
}