#include<stdio.h>
#include<string.h>
#include<ctype.h>
 
int main(){
    char s[101];
    fgets(s, sizeof(s), stdin);
    s[strcspn(s,"\n")] = 0;
    if(!strspn(s, "apcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) { 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(" "));
    }
    return 0;
}