RosettaCodeData/Task/Longest-string-challenge/Nanoquery/longest-string-challenge.na...

27 lines
318 B
Plaintext

import Nanoquery.IO
def longer(a, b)
try
b[len(a)-1]
return false
catch
return true
end
end
print "enter filename: "
$f = new(File, input())
longest = ""
lines = ""
for x in $f.read()
if longer(x, longest)
lines = x
longest = x
else if !longer(longest, x)
lines += "\n" + x
end
end
println lines