|
|
back to boardWhy I got WA??? var s,sd:string; i:integer; begin while not (eof) do begin readln(s); sd:=''; for i:=1 to length(s) do if s[i]in['A'..'z'] then sd:=s[i]+sd else begin write(sd);write(s[i]);sd:='' end; if s[i] in ['A'..'z']then write(sd); writeln end end. Re: Why I got WA??? Posted by Pooya 7 Mar 2003 17:59 Hi I think the misteke is :
*****if s[i]in['A'..'z'] then sd:=s[i]+sd should be *****if (s[i]in['A'..'Z']) or (s[i]in['a'..'z']) then sd:=s[i]+sd and in the line 11 the mistake is the same. yours pooya email: pooyahat@yahoo.com in the > var > s,sd:string; > i:integer; > begin > while not (eof) do begin > readln(s); > sd:=''; > for i:=1 to length(s) do > if s[i]in['A'..'z'] then sd:=s[i]+sd{********} > else begin write(sd);write(s[i]);sd:='' end; > if s[i] in ['A'..'z']then write(sd); > writeln > end > end. |
|
|