RosettaCodeData/Task/Longest-string-challenge/Icon/longest-string-challenge-1.icon
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

14 lines
544 B
Text

procedure main(arglist)
local b # the current buffer (string)
local l # the last string
local L # a \n delimited accumulation of all the longest strings
while b := read() do {
/l := b # primes l on first pass
b ? ( move(*l), if move(1) then L := (l := b) || "\n" else if move(0) then L := (\L|"") || b || "\n")
# move(*l) - fails if b is not l characters long
# move(1) - succeeds/fails if the string is longer and triggers a reset of L
}
write(\L)
end