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