#include <iostream>
#include <string>
using namespace std;
int main(void) {
int T;
cin >> T;
string str;
while (T--) {
cin >> str;
int len = str.length();
int i = 0;
while (i < len) {
if (str[i] == '0' || str[i] == '2' || str[i] == '4'
|| str[i] == '6' || str[i] == '9') {
cout << str[i];
i++;
}
else if (str[i] == 't' || str[i] == 's') {
string temp = str.substr(i, 3);
if (temp == "two" || temp == "six") {
if (temp == "two") {
cout << "2";
}
else if (temp == "six") {
cout << "6";
}
i += 3;
}
else i++;
}
else if (str[i] == 'z' || str[i] == 'f' || str[i] == 'n') {
string temp = str.substr(i, 4);
if (temp == "zero" || temp == "four" || temp == "nine") {
if (temp == "zero") {
cout << "0";
}
else if (temp == "four") {
cout << "4";
}
else cout << "9";
i += 4;
}
else i++;
}
else i++;
}
cout << endl;
}
return 0;
}
用到了string类,暴力即可