shixun
#include<iostream>
#include<stack>
#include<string>
#include<stdlib.h>
using namespace std;
int main(){
?string s;
?getline(cin,s);
?string temp="";
?int n,i,n1,n2,r;
?stack<int> t;
?n=s.length();
?for(i=n-1;i>=0;i--){
? if(isdigit(s[i])||s[i]=='-')
? temp+=s[i];
? if((isdigit(s[i])||s[i]=='-')&&(s[i-1]=='('||s[i-1]==')'||s[i-1]==',')){
? int num;
? num=atoi(temp.c_str());
? t.push(num);
? temp="";
}
if(isalpha(s[i]))
temp+=s[i];
if(isalpha(s[i])&&!isalpha(s[i-1])){
if(temp=="add"){
n1=t.top();t.pop();
n2=t.top();t.pop();
r=n1+n2;
t.push(r);
}else if(temp=="sub"){
n1=t.top();t.pop();
n2=t.top();t.pop();
r=n1-n2;
t.push(r);
}else if(temp=="div"){
n1=t.top();t.pop();
n2=t.top();t.pop();
r=n1/n2;
t.push(r);
}else if(temp=="mul"){
n1=t.top();t.pop();
n2=t.top();t.pop();
r=n1*n2;
t.push(r);
}
}
?}
?cout<<t.top()<<endl;
?return 0;
}