#include #include char in[81]; int pos, P,Q,R; int get(){ return in[pos++]; } int parse() { int c = get(), ope, d; if( c == 'P' ) return P; if( c == 'Q' ) return Q; if( c == 'R' ) return R; if( c == '-' ) return 2-parse(); if(isdigit(c)) return c-'0'; c = parse(); ope = get(); d = parse(); get(); return ope == '+' ? (c>d?c:d) : (c