|
|
back to boardHelp! Why my program got WA at test4??? I didn't know! This is my program: var a:array [1..80] of char; hand:integer; procedure work(ch:char); begin if ch='>' then begin inc(hand); if hand>=80 then hand:=1; end else if ch='<' then begin dec(hand); if hand<=1 then hand:=1; end else if (ch>='a')and(ch<='z')or(ch>='A')and(ch<='Z') then begin a[hand]:=ch; inc(hand); if hand>=80 then hand:=1; end else begin a[hand]:=ch; inc(hand); if hand<1 then hand:=1; end; end; procedure init; var ch:char; begin hand:=1; fillchar(a,sizeof(a),' '); repeat read(ch); work(ch); until eof; end; procedure print; var i:integer; begin for i:=1 to 80 do write(a[i]); writeln; end; begin init; print; end. |
|
|