#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
    char s[101];
    fgets(s, sizeof(s), stdin);
    s[strcspn(s, "\n")] = '\0';
    for (int i = 0; s[i] != '\0'; i++) {
        if (!isalpha(s[i]) && s[i] !=" ") {
            printf("Invalid input");
            return 0;
        }
    }
    int len = strlen(s);
    int start = 0;
    for (int i = 0; i <= len; i++) {
        if (s[i] == ' ' || s[i] =='\0') {
            int end = i - 1;
            while (start < end) {
                char temp = s[start];
                s[start] = s[end];
                s[end] = temp;
                start++;
                end--;
            }
            start = i + 1;
        }
    }
    printf("%s", s);
    return 0;
}