#include<iostream>
#include<stack>
using namespace std;
int main() {
    string text;
    getline(cin, text);
    stack<string> sta;
    string str;
    for(int i=0;i<text.length();i++) {
        if(text[i] != ' ') {
            str += text[i];
        }else {
            sta.push(str);
            str = "";
        }
        if(i == text.length()-1) {
            sta.push(str);
        }
    }
    while(!sta.empty()) {
        if(sta.size()==1)
            cout<<sta.top();
        else
            cout<<sta.top()<<" ";
        sta.pop();
    }
    cout<<endl;
    return 0;
}