/*
ID: sdjllyh1
PROG: namenum
LANG: JAVA
complete date: 2008/9/23
author: LiuYongHui From GuiZhou University Of China
more article: www.cnblogs.com/sdjls
*/
import java.io.*;
import java.util.*;
public class namenum
{
public static String sn = "";
public static void main(String[] args) throws IOException
{
init();
output();
System.exit(0);
}
private static void init() throws IOException
{
BufferedReader f = new BufferedReader(new FileReader("namenum.in"));
StringTokenizer st = new StringTokenizer(f.readLine());
sn = st.nextToken();
f.close();
}
private static void output() throws IOException
{
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("namenum.out")));
cow theCow = new cow(sn);
ArrayList names = theCow.getNames();
if (names.size() == 0)
{
out.println("NONE");
}
else
{
for (int i = 0; i < names.size(); i++)
{
out.println(names.get(i));
}
}
out.close();
}
}
class cow
{
String sn = "";
ArrayList name = new ArrayList();
public cow(String sn) throws IOException
{
this.sn = sn;
initNames();
}
public ArrayList getNames()
{
return this.name;
}
private void initNames() throws IOException
{
BufferedReader f = new BufferedReader(new FileReader("dict.txt"));
for (int i = 0; i < 4167; i++)
{
String word = f.readLine();
if (wordToNum(word).equals(this.sn))
this.name.add(word);
}
f.close();
}
private String wordToNum(String word)
{
String num = "";
for (int i = 0; i < word.length(); i++)
num += letterToNum(word.charAt(i));
return num;
}
private char letterToNum(char letter)
{
char num;
switch (letter)
{
case 'A':
case 'B':
case 'C':
num = '2';
break;
case 'D':
case 'E':
case 'F':
num = '3';
break;
case 'G':
case 'H':
case 'I':
num = '4';
break;
case 'J':
case 'K':
case 'L':
num = '5';
break;
case 'M':
case 'N':
case 'O':
num = '6';
break;
case 'P':
case 'R':
case 'S':
num = '7';
break;
case 'T':
case 'U':
case 'V':
num = '8';
break;
case 'W':
case 'X':
case 'Y':
num = '9';
break;
default:
num = '0';
break;
}
return num;
}
}
ID: sdjllyh1
PROG: namenum
LANG: JAVA
complete date: 2008/9/23
author: LiuYongHui From GuiZhou University Of China
more article: www.cnblogs.com/sdjls
*/
import java.io.*;
import java.util.*;
public class namenum
{
public static String sn = "";
public static void main(String[] args) throws IOException
{
init();
output();
System.exit(0);
}
private static void init() throws IOException
{
BufferedReader f = new BufferedReader(new FileReader("namenum.in"));
StringTokenizer st = new StringTokenizer(f.readLine());
sn = st.nextToken();
f.close();
}
private static void output() throws IOException
{
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("namenum.out")));
cow theCow = new cow(sn);
ArrayList names = theCow.getNames();
if (names.size() == 0)
{
out.println("NONE");
}
else
{
for (int i = 0; i < names.size(); i++)
{
out.println(names.get(i));
}
}
out.close();
}
}
class cow
{
String sn = "";
ArrayList name = new ArrayList();
public cow(String sn) throws IOException
{
this.sn = sn;
initNames();
}
public ArrayList getNames()
{
return this.name;
}
private void initNames() throws IOException
{
BufferedReader f = new BufferedReader(new FileReader("dict.txt"));
for (int i = 0; i < 4167; i++)
{
String word = f.readLine();
if (wordToNum(word).equals(this.sn))
this.name.add(word);
}
f.close();
}
private String wordToNum(String word)
{
String num = "";
for (int i = 0; i < word.length(); i++)
num += letterToNum(word.charAt(i));
return num;
}
private char letterToNum(char letter)
{
char num;
switch (letter)
{
case 'A':
case 'B':
case 'C':
num = '2';
break;
case 'D':
case 'E':
case 'F':
num = '3';
break;
case 'G':
case 'H':
case 'I':
num = '4';
break;
case 'J':
case 'K':
case 'L':
num = '5';
break;
case 'M':
case 'N':
case 'O':
num = '6';
break;
case 'P':
case 'R':
case 'S':
num = '7';
break;
case 'T':
case 'U':
case 'V':
num = '8';
break;
case 'W':
case 'X':
case 'Y':
num = '9';
break;
default:
num = '0';
break;
}
return num;
}
}