RosettaCodeData/Task/Longest-string-challenge/Pike/longest-string-challenge.pike

21 lines
495 B
Plaintext

int main(int argc, array argv)
{
string longest = "";
foreach(Stdio.stdin.line_iterator();; string line)
{
if( sizeof(indices(line) - indices(longest)))
{
while(!zero_type(remove_call_out(write)));
longest = line;
call_out(write, 0, line+"\n");
}
else if( !sizeof(indices(longest) - indices(line)))
{
call_out(write, 0, line+"\n");
}
}
call_out(exit, 0.01, 0);
return -1;
}