wzb6907 @ 2017-04-16 15:52:57
#include<bits/stdc++.h>
using namespace std;
map<string,string> p;
string s[7];
string a[7];
long long val;
bool cmp(string a,string b)
{
return a+b<b+a;
}
int main()
{
p["one"]="01"; p["two"]="04"; p["three"]="09"; p["four"]="16"; p["five"]="25";
p["six"]="36"; p["seven"]="49"; p["eight"]="64"; p["nine"]="81"; p["ten"]="00";
p["eleven"]="21"; p["twelve"]="44"; p["thirteen"]="69"; p["fourteen"]="96";p["fifteen"]="25";
p["sixteen"]="56"; p["seventeen"]="89";p["eighteen"]="24"; p["nineteen"]="61";p["twenty"]="00";
p["a"]="01"; p["both"]="04"; p["another"]="01"; p["first"]="01"; p["second"]="04";
p["third"]="09";
for(int i=1;i<=6;i++)
{
cin>>s[i];
transform(s[i].begin(),s[i].end(),s[i].begin(),::tolower);
//cout<<s[i]<<endl;
}
int k=0;
for(int i=1;i<=6;i++)
{
if(p.count(s[i]))
{
//cout<<s[i]<<endl;
k++;
a[k]=p[s[i]];
//cout<<a[k]<<"* "<<k<<endl;
}
}
if(k==0) {cout<<0<<endl;return 0;}
sort(a+1,a+k,cmp);
stringstream stream;
for(int i=1;i<=k;i++) stream<<a[i];
stream>>val;
cout<<val;
return 0;
}