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 1226. esreveR redrO

Help! I got WA!
Posted by Algorithmus_UA(algorithmus@univ.kiev.ua) 19 Nov 2002 13:57
var tmp:string;
    ch:char;
    j:integer;
begin
  tmp:='';
  while not eof do
  begin
    read(ch);
    if ch in ['A'..'z'] then
    begin
      tmp:=tmp+ch;
    end
    else
    begin
      for j:=length(tmp) downto 1 do write(tmp[j]);
      write(ch);
      tmp:='';
    end;
  end;
end.
See my solution on this webboard i got AC. Can you chack my anather programs on webboard
Posted by I am david. Tabo. 19 Nov 2002 14:44
This will Help!
Posted by JL Wang 19 Nov 2002 20:09
> var tmp:string;
>     ch:char;
>     j:integer;
> begin
>   tmp:='';
>   while not eof do
>   begin
>     read(ch);
>     if ch in ['A'..'z'] then
>     begin
>       tmp:=tmp+ch;
>     end
>     else
>     begin
>       for j:=length(tmp) downto 1 do write(tmp[j]);
>       write(ch);
>       tmp:='';
>     end;
>   end;
> end.



Hey, man! There's two mistakes in your program:
1.There's a lot of other symbol (not letter) between 'A'..'Z'
and 'a'..'z' in ASCII order. So do use set ['A'..'Z','a'..'z']
instead of set ['A'..'z'].
2.If the input ends by a letter not a symbol, your program will not
output the last word.

PS: If you still don't understand, see my solution below, it is an AC
one.
But i got AC
Posted by I am david. Tabo. 19 Nov 2002 21:40
> > var tmp:string;
> >     ch:char;
> >     j:integer;
> > begin
> >   tmp:='';
> >   while not eof do
> >   begin
> >     read(ch);
> >     if ch in ['A'..'z'] then
> >     begin
> >       tmp:=tmp+ch;
> >     end
> >     else
> >     begin
> >       for j:=length(tmp) downto 1 do write(tmp[j]);
> >       write(ch);
> >       tmp:='';
> >     end;
> >   end;
> > end.
>
>
>
> Hey, man! There's two mistakes in your program:
> 1.There's a lot of other symbol (not letter) between 'A'..'Z'
> and 'a'..'z' in ASCII order. So do use set ['A'..'Z','a'..'z']
> instead of set ['A'..'z'].
> 2.If the input ends by a letter not a symbol, your program will not
> output the last word.
>
> PS: If you still don't understand, see my solution below, it is an
AC
> one.