#include <algorithm>
#include <cstddef>
#include <iostream>
using namespace std;

int main() {
    string str;
    getline(cin, str); // 获取字符串
    reverse(str.begin(), str.end()); // 先反转一下字符串

    size_t len = str.length();
    
  // 逐个翻转单词
    for(size_t i = 0; i < len; i++){
        size_t j = i;
        while(str[j] != ' ' && j < len){
            ++j;
        }
        reverse(str.begin()+i, str.begin()+j);
        i = j;
    }

    cout << str << endl;
}
// 64 位输出请用 printf("%lld")