public static void main(String[] args) throws Exception{
String[] str = {"watch","match","noise","risky","stock","work","back",
"come","deal","desk","book","java","tool","face"};
Scanner s = new Scanner(System.in);
String num = s.nextLine();
for(int i=0;i
if(match(num, str[i])) {
System.out.println(str[i]);
break;
}
}
System.out.println("not found!");
s.close();
}
public static boolean match(String num, String str) {
for(int i=0;i
if(i>str.length() || i > num.length()
|| !match(num.charAt(i), str.charAt(i))) {
return false;
}
}
return true;
}
public static boolean match(char num, char str) {
switch(num) {
case '2':
case '3':
case '4':
case '5':
case '6':
return (str-'a')/3==num-'2';
case '7':
return str>='p' && str <='s';
case '8':
return str>='t' && str <='v';
case '9':
return str>='w' && str <='z';
default:
}
return false;
}