program YODA;
var s,s1,h,h1:string;
    j,i,c,b:integer;
begin
  read(s);
  for i:=length(s) downto 1 do
   s1:=s1+s[i];
  b:=1;
  h:='';
  s:='';
  h1:='';
  s1:='|'+s1;
  for i:=1 to length(s1) do
   if s1[i]=' ' then inc (c);

  for i:=1 to c do begin

   for j:=pos('|',s1)+1 to pos(' ',s1) do
    h:=h+s1[j];
   for j:=length(h) downto 1 do
    h1:=h1+h[j];
   s:=s+h1;
   s1[pos(' ',s1)]:='|';
   h1:='';
   h:='';
   s1[pos('|',s1)]:=';';

  end;

  for j:=length(s1) downto pos('|',s1) do
   h1:=h1+s1[j];
  s:=s+' '+h1;
  delete(s,1,1);
  delete(s,length(s),1);

  writeln(s);
end.