/*
ID: your_id_here
PROG: namenum
LANG: C++11
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string trans(string in) {
string str = in;
for (int i = 0; i < str.size(); i++) {
char &item = str[i];
switch (item) {
case 'A': case 'B': case 'C': item = '2'; break;
case 'D': case 'E': case 'F': item = '3'; break;
case 'G': case 'H': case 'I': item = '4'; break;
case 'J': case 'K': case 'L': item = '5'; break;
case 'M': case 'N': case 'O': item = '6'; break;
case 'P': case 'R': case 'S': item = '7'; break;
case 'T': case 'U': case 'V': item = '8'; break;
case 'W': case 'X': case 'Y': item = '9'; break;
}
}
return str;
}
int main() {
ofstream fout ("namenum.out");
ifstream fin ("namenum.in");
ifstream dict ("dict.txt");
int n = 0;
string row;
fin >> row;
string names;
while (dict >> names) {
string name = trans(names);
if (name == row) {
fout << names << endl;
n++;
}
}
if (n == 0)
fout << "NONE" << endl;
return 0;
}
Name that Num
最新推荐文章于 2021-12-12 09:45:57 发布