#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max 25


char stack[max][max];
int top=-1;

char* push(char str[]){
    strcpy(stack[++top],str);
} 
char* pop(){
    return stack[top--];
}

void prefix(char str[]){
    int len = strlen(str),chlen;
    char ch;
    for(int i =len;i>=0;i--){
        ch=str[i];
        if(isalnum(ch)){
            char temp[2];
            temp[0] = ch;
            temp[1] = '\0';
            push(temp);
        }
        else if(!(ch == '+')){
            printf("Invalid input");
            return 0;
        }
        else{
            char op1[max],op2[max],res[max];
            strcpy(op2,pop());
            strcpy(op1,pop());
            strcat(res,op2);
            strcat(res,op1);
            chlen = strlen(res);
            res[chlen]= ch;
            res[chlen+1] = '\0';
            push(res);
        }
    }
    printf("%s",stack[top]);
}

int main(){
    char str[max];
    scanf("%s",&str);
    prefix(str);
    return 0;
}