Test for short strings!

procedure is_OK(x)
  every i:=1 to *x-1 do
    if x[i]>>x[i+1] then fail
  return x
end

procedure forgotten_algorithm(x)
repeat
{ x[?*x] :=: x[?*x]
   if is_OK(x) then return x
}
end

procedure main()
repeat {x:=read(); write(forgotten_algorithm(x))}
end
----
Kazimir Majorinc, Zagreb, Croatia

Reply via email to