ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1102. Strange Dialog

Why I get WA?I think my program is right,but still got WA
Posted by qwt 21 Mar 2002 17:57
const
  ss:array[1..6] of string[7]=(
  'one    ',
  'puton  ',
  'in     ',
  'input  ',
  'out    ',
  'output ');
var
  z:char;
  a:array[1..6] of longint;
  i,j,k,n:longint;
  useful,t,f,o:boolean;
begin
  readln(n);
  for i:=1 to n do begin
    useful:=true;
    fillchar(a,sizeof(a),0);
    o:=true;;
    while not(eoln) do begin
      read(z);t:=false;f:=false;
      for j:=1 to 6 do
        if z=ss[j,a[j]+1] then begin
          if (a[j]=0)and(o=false) then continue;
          t:=true;
          inc(a[j]);
          if ss[j][a[j]+1]=' ' then begin a[j]:=0;f:=true;end;
        end else begin
          a[j]:=0;
          if (o)and(ss[j][1]=z) then begin inc(a[j]);f:=true;end;
        end;
      if t=false then begin f:=false;break;end;
      o:=f;
    end;
    readln;
    if f then writeln('YES') else writeln('NO');
  end;
end.