var s,s1,s2:string;
    i,br,j,z:integer;
    b:boolean;
begin
 readln(s1);
 for i:=length(s1) downto 1 do s:=s+s1[i];
 repeat
   b:=true;
   z:=length(s);
   for i:=1 to z do
    if (s[i]=' ')and(b=true) then
     begin
       b:=false;
       for j:=i-1 downto 1 do s2:=s2+s[j];
       if i<>z then s2:=s2+' ';
       delete(s,1,pos(' ',s));
     end;
 until pos(' ',s)=0;
 for i:=length(s) downto 1 do s2:=s2+s[i];
 writeln(s2)
end.





































