#include <string.h> #include <stdio.h> #include <stdlib.h> #include<iostream> #include<math.h> using namespace std; char num[10][10]={"zero","one","two","three","four","five","six","seven","eight" ,"nine"}; int main(void) { char a[1000],b[1000],c[1000],e[5],f[5];int len,middle,temp,i,j,sumb,sumc,sum[3],sumall,temp2; while(cin.getline(a,1000,'\n')) { char add='+'; char empty=' '; int len=strlen(a); len-=2;//a[len+1]='\0'; int middle=(strchr(a,add)-a); for(i=0;i<middle;i++) { b[i]=a[i]; } b[i]='\0'; i+=2;j=0; for(;i<len+1;i++) { c[j++]=a[i]; } c[j]='\0'; temp=0; for(i=0;i<4;i++) e[i]=b[i]; e[i]='\0'; for(i=0;i<4;i++) f[i]=b[i]; f[i]='\0'; if(strcmp(e,num[0])==0&&strcmp(f,num[0])==0) return 0; sumall=0; memset(sum,0,sizeof(int)*3); while(strchr(b,empty)) { int middle=(strchr(b,empty)-b); for(i=0;i<middle;i++) a[i]=b[i]; a[i]='\0'; for(i=0;i<10;i++) if(strcmp(a,num[i])==0) sum[temp++]=i; temp2=strlen(b); for(i=0;i<=temp2-middle;i++) b[i]=b[i+middle+1]; } temp--; for(i=temp;i>=0;i--) sumall+=sum[i]*pow(10,(temp-i)); memset(sum,0,sizeof(int)*3); temp=0; while(strchr(c,empty)) { int middle=(strchr(c,empty)-c); for(i=0;i<middle;i++) a[i]=c[i]; a[i]='\0'; for(i=0;i<10;i++) if(strcmp(a,num[i])==0) sum[temp++]=i; temp2=strlen(c); for(i=0;i<=temp2-middle;i++) c[i]=c[i+middle+1]; } temp--; for(i=temp;i>=0;i--) sumall+=sum[i]*pow(10,(temp-i)); printf("%d\n",sumall); } }