Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
function longer(a, b)
|
||||
try
|
||||
b[endof(a)]
|
||||
catch
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function printlongest(io::IO)
|
||||
lines = longest = ""
|
||||
while !eof(io)
|
||||
line = readline(io)
|
||||
if longer(line, longest)
|
||||
longest = lines = line
|
||||
elseif !longer(longest, line)
|
||||
lines *= "\n" * line
|
||||
end
|
||||
end
|
||||
println(lines)
|
||||
end
|
||||
printlongest(str::String) = printlongest(IOBuffer(str))
|
||||
|
||||
printlongest("a\nbb\nccc\nddd\nee\nf\nggg")
|
||||
Loading…
Add table
Add a link
Reference in a new issue