#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX_SIZE 1000
typedef struct{
    char array[MAX_SIZE];
    int top;
}charstack;
void intistack(charstack*stack){
    stack->top=-1;
}
void push(charstack*stack,char value){
    if(stack->top<MAX_SIZE-1){
        stack->array[++(stack->top)]=value;
    }
}
char pop(charstack*stack){
    if(stack->top>=0){
        return stack->array[(stack->top)--];
    }
    return '\0';
}
int isempty(charstack*stack){
    return stack->top==-1;
}
int isoperator(char c){
    return c=='+'||c=='-'||c=='*'||c=='/'||c=='^';
}
char*prefixtopostfix(const char*expression){
    static char result[MAX_SIZE];
    charstack stack;
    intistack(&stack);
    int j=0;
    for(int i=strlen(expression)-1;i>=0;i--){
        char c=expression[i];
        if(isspace(c)){
            continue;
        }
        if(isalnum(c)){
            push(&stack,c);
        }else if(isoperator(c)){
            if(stack.top<1){
                if(stack.top<1){
                    return "Invalid input";
                }
                char op1=pop(&stack);
                char op2=pop(&stack);
                result[j++]=op1;
                 result[j++]=op2;
                  result[j++]=c;
                  push(&stack,result[j-1]);
            }else{
                return "Invalid input";
            }
        }
        while(!isEmpty(&stack)){
            result[j++]=pop(&stack);
        }
        result[j]='\0';
        for(int k=0;k<j/2;k++){
            char temp=result[k];
            result[k]=reslut[j-k-1];
            result[j-k-1];
            result[j-k-1]=temp;
        }
        return result;
    }
    int main(){
        char prefixexpression[MAX_SIZE];
        fgets(prefixexpression,sizeof(prefixexpression),stdin);
        size_t len=strlen(prefixexpression);if(len>0 && prefixexpression[len-1]=='\n'){
            prefixexpression[len-1]='\0';
        }
        char*postfixexpression=prefixtopostfix(prefixexpression);
        printf("%s",postfixexpression);
        return 0;
    }