Please help!
#include
typedef long long int lli;
using namespace std;
void print_stack(stack st){
while(!st.empty()){
cout << st.top()<<" ";
st.pop();
}
cout <<endl;
}
int main(){
map z;
z['O'] = 16;
z['H'] = 1;
z['C'] = 12;
string s;
cin >> s;
stack st;
//cout << s<<endl;
for(int i =0;i<s.size();i++){
if(s[i]=='(' || s[i]==')' ||isdigit(s[i]) || s[i]=='H'||s[i]=='C'||s[i]=='O'){
//cout << s[i] << endl;
if(s[i] =='('){
//cout << "Pushing Bracket!"<<endl;
st.push(-1);
}
else if(isalpha(s[i])){
//cout << "Pushing Alphabet!"<<endl;
if(st.empty()||st.top()==-1 ){
if(isdigit(s[i+1])){
st.push(z[s[i]]*(s[i+1]-'0'));
i++;
// cout << "Push & Multiply!"<<endl;
}else{
st.push(z[s[i]]);
// cout << "Just Push!"<<endl;
}
}else{
if(isdigit(s[i+1])){
lli k =0;
k = st.top();
k+=(z[s[i]]*(s[i+1]-'0'));
st.pop();
st.push(k);
i++;
// cout << "Add & Multiply!"<<endl;
}else{
lli k =0;
k = st.top();
k+=(z[s[i]]);
st.pop();
st.push(k);
// cout << "Add!"<<endl;
}
}
} else if(s[i]==')'){
//print_stack(st);
lli a = st.top();
st.pop();
st.pop();
if(isdigit(s[i+1])){
if(!st.empty()&&st.top()!=-1){
lli m = st.top();
// cout << "m = "<<m<<endl;
st.pop();
st.push(m + (a * (s[i+1]-'0')));
i++;}else{
st.push(a * (s[i+1]-'0'));
}
}else{
if(!st.empty()&&st.top()!=-1){
lli m = st.top();
st.pop();
// cout << "m = "<<m<<endl;
st.push(m + (a));
i++;}else{
st.push(a);
}
}
// cout << "Closing Bracket!!"<<endl;
}}
//print_stack(st);
}
lli sum = 0;
while(!st.empty()){
sum += st.top();
st.pop();
}
cout <<sum ;
return 0;
}