Why WA? Neither first my program, nor second are right. Why??! Here they are: program first; const ks : set of char = ['>','<','a'..'z','A'..'Z','0'..'9',';',':','- ','!','?','.',',',' ']; var ch : char; pos : byte; res : string[80]; begin res:=''; for pos:=1 to 80 do res:=res+' '; pos:=1; ch:=#0; while (ch<>#26) do begin read(ch); if ch=#26 then break; if not (ch in ks) then continue; if ch='>' then begin if pos=80 then pos:=1; end else if ch='<' then begin if pos<>1 then dec(pos); end else begin res[pos]:=ch; if pos=79 then pos:=1 else inc(pos); end end; Writeln(res); end. program second; const ks : set of char = ['>','<','a'..'z','A'..'Z','0'..'9',';',':','- ','!','?','.',',',' ']; var ch : char; pos : byte; res : string[80]; begin res:=''; for pos:=1 to 80 do res:=res+' '; pos:=1; ch:=#0; while (ch<>#26) do begin read(ch); if ch=#26 then break; if not (ch in ks) then continue; if ch='>' then begin if pos=80 then pos:=1; end else if ch='<' then begin if pos<>1 then dec(pos); end else if pos = 80 then begin res[pos]:=ch; pos:=1; end else begin res[pos]:=ch; inc(pos); end end; Writeln(res); end. Please, help! Sorry!! I've found mistake! Sorry! program p1094; const ks : set of char = ['>','<','a'..'z','A'..'Z','0'..'9',';',':','- ','!','?','.',',',' ']; var ch : char; pos : byte; res : string[80]; begin res:=''; for pos:=1 to 80 do res:=res+' '; pos:=1; ch:=#0; while (ch<>#26) do begin read(ch); if ch=#26 then break; if not (ch in ks) then continue; if ch='>' then begin if pos=80 then pos:=1 else inc(pos); end else if ch='<' then begin if pos<>1 then dec(pos); end else if pos = 80 then begin res[pos]:=ch; pos:=1; end else begin res[pos]:=ch; inc(pos); end end; Writeln(res); end. |