#include <iostream>

using namespace std;

bool is_char(int c) {
    if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') return true;
    else return false;
}

int main() {
    string str, ans;
    while (cin >> str) {
        int i = 0;
        while (i < str.size()) {
            while (!is_char(str[i])) i++;
            string tem;
            int j;
            for (j = i; is_char(str[j]) && j < str.size(); ++j) {
                tem += str[j];
            }
            ans = tem + " " + ans;
            i = j;
        }
    }
    cout << ans << endl;
}