You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<bits/stdc++.h>
using namespace std;
//原始英文数字
// You are a three eight pig . 10964
unordered_map<string, int> _map = {{"zero", 0},
{"one", 1},
{"two", 4},
{"three", 9},
{"four", 16},
{"five", 25},
{"six", 36},
{"seven", 49},
{"eight", 64},
{"nine", 81},
{"ten", 0},
{"eleven", 21},
{"twelve", 44},
{"thirteen", 69},
{"fourteen", 96},
{"fifteen", 25},
{"sixteen", 56},
{"seventeen", 89},
{"eighteen", 24},
{"nineteen", 61},
{"twenty", 0},
{"a", 1},
{"both", 4},
{"another", 1},
{"first", 1},
{"second", 4},
{"third", 9}
};
string s;
const int N = 1010;
int a[N];
int idx;
int main() {
//ctrl+d,或者ctrl+z结束
while (cin >> s)
if (_map[s]) a[idx++] = _map[s];
sort(a, a + idx);
string res = "";
for (int i = 0; i < idx; i++) {
if (i > 0 && a[i] < 10) res += "0" + to_string(a[i]);
else res += to_string(a[i]);
}
//第3个点需要特判没任何数字输出0很坑……
if (res != "") cout << res << endl;
else cout << 0 << endl;
return 0;
}