#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string str = "";
getline(cin, str);
str += " ";
vector<string> vec;
string tmp = "";
for(char c : str){
if(!isalpha(c)){
if(!tmp.empty()){
vec.push_back(tmp);
tmp.clear();
}
}
else{
tmp += c;
}
}
reverse(vec.begin(), vec.end());
string res = "";
for(int i = 0; i < vec.size(); i++){
//cout << vec[i]<<endl;
res += vec[i];
res += " ";
}
res.pop_back();
cout << res << endl;
return 0;
}