//Author:PanDaoxi
#include <iostream>
#include <cstring>
using namespace std;
int main(){
const int n=501;
char a[n];
int len,s=0,c=0,k=0;
cin.getline(a,n);
len=strlen(a);
for(int i=0;i<len;i++){
if(a[i]==' '||i==len-1){
c++;
if(i==len-1) k=i;
else k=i-1;
for(int j=k;j>=s;j--) cout<<a[j];
if(c==1){
cout<<" ";
c=0;
}
s=i+1;
}
}
cout<<endl;
return 0;
}