# include<stdio.h> #include<iostream> # include<queue> # include<math.h> # include<stack> using namespace std; int sum=0; queue<char> s1; int zhen(string sa) { if(sa=="zero") return 0; else if(sa=="one") return 1; else if(sa=="two") return 2; else if(sa=="three") return 3; else if(sa=="four") return 4; else if(sa=="five") return 5; else if(sa=="six") return 6; else if(sa=="seven") return 7; else if(sa=="eight") return 8; else return 9; } void calc_sum(){ string sa; stack<int> s2; if(s1.front()==' ') s1.pop(); while(!s1.empty()) { char c=s1.front(); if(c!=' ') { sa+=c; } else{ s2.push(zhen(sa)); sa.clear(); } s1.pop(); } int cnt=0; while(!s2.empty()) { int t=s2.top(); sum+=pow(10,cnt)*t; cnt++; s2.pop(); } } int main(){ string s; while(getline(cin,s)) { for(int i=0;i<s.length();i++) { if(s[i]!='+'&&s[i]!='=') { s1.push(s[i]); } else{ calc_sum(); while(!s1.empty()) { s1.pop(); } } } if(sum==0) break; printf("%d\n",sum); sum=0; } }