#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    string word;
    getline(cin,word);
    vector<string> vec;
    string temp="";

    for(int i=0;i<word.size();i++){
        if(isalpha(word[i])){
            temp+=word[i];
        }else {
            vec.push_back(temp);
            temp="";
        }
    }
     vec.push_back(temp);
    for(auto iter=vec.rbegin();iter!=vec.rend();++iter){
        cout<<*iter<<" ";
    }
}
// 64 位输出请用 printf("%lld")