当需要字符串对应数字时,map是非常好用的
#include <bits/stdc++.h>
using namespace std;
map<string,int>q;
string s;
int st[1000],cnt=0;
int main()
{
/*
打表
当需要字符串对应数字时,map是非常好用的
*/
q["one"]=1;q["two"]=2;q["three"]=3;q["four"]=4;q["five"]=5;q["six"]=6;q["seven"]=7;q["eight"]=8;q["nine"]=9;q["ten"]=10;
q["eleven"]=11;q["twelve"]=12;q["thirteen"]=13;q["fourteen"]=14;q["fifteen"]=15;q["sixteen"]=16;q["seventeen"]=17;q["eighteen"]=18;q["nineteen"]=19;q["twenty"]=20;
q["a"]=1;q["both"]=2;q["another"]=1;q["first"]=1;q["second"]=2;q["third"]=3;
cin>>s;
while(s!=".")
{
if(q[s])
{
int k=q[s]*q[s]%100;
if(k==0) continue;
st[cnt++]=k;
}
cin>>s;
}
sort(st,st+cnt);
cout<<st[0];
for(int i=1;i<cnt;i++)
{
if(st[i]<10) cout<<0;
cout<<st[i];
}
return 0;
}