Longest string challenge: Difference between revisions
Content added Content deleted
(Added various BASIC dialects (BASIC256, Chipmunk Basic, GW-BASIC and MSX Basic)) |
imported>Chinhouse No edit summary |
||
Line 1,621: | Line 1,621: | ||
[1,3] = ggg |
[1,3] = ggg |
||
} </pre> |
} </pre> |
||
=={{header|MiniScript}}== |
|||
{{trans|Python}} |
|||
<syntaxhighlight lang="miniscript"> |
|||
string.isLonger = function(s) |
|||
return self.hasIndex(s.len) |
|||
end function |
|||
longest = "" |
|||
lines = "" |
|||
current = input |
|||
while current |
|||
if current.isLonger(longest) then |
|||
lines = current |
|||
longest = current |
|||
else if not longest.isLonger(current) then |
|||
lines += current |
|||
end if |
|||
current = input |
|||
end while |
|||
for i in range(0, lines.len, longest.len) |
|||
print lines[i:i + longest.len] |
|||
end for |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
a |
|||
bb |
|||
ccc |
|||
dd |
|||
eee |
|||
f |
|||
ggg |
|||
hh |
|||
ccc |
|||
eee |
|||
ggg |
|||
</pre> |
|||
=={{header|Nanoquery}}== |
=={{header|Nanoquery}}== |