#include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
while(getline(cin,a))
{
char b[10000][15]={0};
long long l=0,i=0,s=0,j=0,k=0,v=0,p=0,x=0,c[1000]={0};
l=a.size();
for(i=0;i<l;i++)
{
if(isalpha(a[i]))
b[j][k++]=a[i];
else
{
j++;k=0;
}
}
for(i=0;i<=j;i++)
{
if(strcmp(b[i],"zero")==0)s=s+0;
else if(strcmp(b[i],"one")==0)s=s+1;
else if(strcmp(b[i],"two")==0)s=s+2;
else if(strcmp(b[i],"three")==0)s=s+3;
else if(strcmp(b[i],"four")==0)s=s+4;
else if(strcmp(b[i],"five")==0)s=s+5;
else if(strcmp(b[i],"six")==0)s=s+6;
else if(strcmp(b[i],"seven")==0)s=s+7;
else if(strcmp(b[i],"eight")==0)s=s+8;
else if(strcmp(b[i],"nine")==0)s=s+9;
else if(strcmp(b[i],"ten")==0)s=s+10;
else if(strcmp(b[i],"eleven")==0)s=s+11;
else if(strcmp(b[i],"twelve")==0)s=s+12;
else if(strcmp(b[i],"thirteen")==0)s=s+13;
else if(strcmp(b[i],"fourteen")==0)s=s+14;
else if(strcmp(b[i],"fifteen")==0)s=s+15;
else if(strcmp(b[i],"sixteen")==0)s=s+16;
else if(strcmp(b[i],"seventeen")==0)s=s+17;
else if(strcmp(b[i],"eighteen")==0)s=s+18;
else if(strcmp(b[i],"nineteen")==0)s=s+19;
else if(strcmp(b[i],"twenty")==0)s=s+20;
else if(strcmp(b[i],"thirty")==0)s=s+30;
else if(strcmp(b[i],"forty")==0)s=s+40;
else if(strcmp(b[i],"fifty")==0)s=s+50;
else if(strcmp(b[i],"sixty")==0)s=s+60;
else if(strcmp(b[i],"seventy")==0)s=s+70;
else if(strcmp(b[i],"eighty")==0)s=s+80;
else if(strcmp(b[i],"ninety")==0)s=s+90;
else if(strcmp(b[i],"hundred")==0)s=s*100;
else if(strcmp(b[i],"thousand")==0)
{
s=s*1000;
c[p++]=s;
s=0;
}
else if(strcmp(b[i],"million")==0)
{
s=s*1000000;
c[p++]=s;
s=0;
}
else if(strcmp(b[i],"negative")==0)
printf("-");
}
for(i=0;i<p;i++)
s=s+c[i];
printf("%lld\n",s);
}
return 0;
}
using namespace std;
int main()
{
string a;
while(getline(cin,a))
{
char b[10000][15]={0};
long long l=0,i=0,s=0,j=0,k=0,v=0,p=0,x=0,c[1000]={0};
l=a.size();
for(i=0;i<l;i++)
{
if(isalpha(a[i]))
b[j][k++]=a[i];
else
{
j++;k=0;
}
}
for(i=0;i<=j;i++)
{
if(strcmp(b[i],"zero")==0)s=s+0;
else if(strcmp(b[i],"one")==0)s=s+1;
else if(strcmp(b[i],"two")==0)s=s+2;
else if(strcmp(b[i],"three")==0)s=s+3;
else if(strcmp(b[i],"four")==0)s=s+4;
else if(strcmp(b[i],"five")==0)s=s+5;
else if(strcmp(b[i],"six")==0)s=s+6;
else if(strcmp(b[i],"seven")==0)s=s+7;
else if(strcmp(b[i],"eight")==0)s=s+8;
else if(strcmp(b[i],"nine")==0)s=s+9;
else if(strcmp(b[i],"ten")==0)s=s+10;
else if(strcmp(b[i],"eleven")==0)s=s+11;
else if(strcmp(b[i],"twelve")==0)s=s+12;
else if(strcmp(b[i],"thirteen")==0)s=s+13;
else if(strcmp(b[i],"fourteen")==0)s=s+14;
else if(strcmp(b[i],"fifteen")==0)s=s+15;
else if(strcmp(b[i],"sixteen")==0)s=s+16;
else if(strcmp(b[i],"seventeen")==0)s=s+17;
else if(strcmp(b[i],"eighteen")==0)s=s+18;
else if(strcmp(b[i],"nineteen")==0)s=s+19;
else if(strcmp(b[i],"twenty")==0)s=s+20;
else if(strcmp(b[i],"thirty")==0)s=s+30;
else if(strcmp(b[i],"forty")==0)s=s+40;
else if(strcmp(b[i],"fifty")==0)s=s+50;
else if(strcmp(b[i],"sixty")==0)s=s+60;
else if(strcmp(b[i],"seventy")==0)s=s+70;
else if(strcmp(b[i],"eighty")==0)s=s+80;
else if(strcmp(b[i],"ninety")==0)s=s+90;
else if(strcmp(b[i],"hundred")==0)s=s*100;
else if(strcmp(b[i],"thousand")==0)
{
s=s*1000;
c[p++]=s;
s=0;
}
else if(strcmp(b[i],"million")==0)
{
s=s*1000000;
c[p++]=s;
s=0;
}
else if(strcmp(b[i],"negative")==0)
printf("-");
}
for(i=0;i<p;i++)
s=s+c[i];
printf("%lld\n",s);
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন