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