#include<bits/stdc++.h>
#include <iostream>
using namespace std;
int main(){
string s;
cin>>s;
char c[s.length()];
int i;
int temp=0;
for(i=0;i<=s.length()-1;i++){
if(s[i]==' '){
while(temp>=1){
cout<<c[temp];
temp--;
}
cout<<endl;
}else if(s[i]>='a'&&s[i]<='z'){
temp++;
c[temp]=s[i];
}
}
return 0;
}
全错为什么