Very simple code and easy to understand


#1
stack<int> S;
int len=A.size();
int a,b;
int temp;

for(int i=0;i<len;i++){
	if(A[i]!="+" && A[i]!="-" && A[i]!="*" && A[i]!="/"){  
	    temp=stoi(A[i]);
	    S.push(temp);
	}
	else{
		b=S.top();
		S.pop();
		a=S.top();
		S.pop();
		if(A[i]=="+")
		    S.push(a+b);
		else if(A[i]=="-")
		    S.push(a-b);
		else if(A[i]=="*")
		    S.push(b*a);
		else
		    S.push(a/b);
	}
}
int ans=S.top();
return ans;