var s,h,b,f:string;
    i,z:integer;

begin
     read(s);
     b:='*';
     z:=length(s);
     for i:=1 to z do
         begin
              h:=copy(s,i,1);
              insert(h,b,1);
         end;
     insert(' ',b,1);
     delete(s,1,z);
     for i:=1 to z+2 do
         begin
              h:=copy(b,i,1);
              if (h=' ') or (h='*') and (i>1) then begin
                                                        z:=i;
                                                        repeat
                                                              z:=z-1;
                                                              f:=copy(b,z,1);
                                                              s:=s+f;
                                                        until f=' ';
                                                   end;
         end;
     delete(s,1,1);
     writeln(s);
end.