1. Title:
Topic Description Following the launch of MIUI8 mobile phone avatar function, MIUI9 plans to launch a phone number of the function: first of all, the phone number plus 8 to take a single digit, and then use the corresponding capital letters instead ("ZERO", "one", "two", "THREE "," FOUR "," FIVE "," SIX "," SEVEN "," Eight "," NINE "), and randomly disrupts these letters, the generated string is the corresponding number of copies of the phone numbers. Enter a description:
The first line is an integer t (1≤t≤100) that represents the test sample number, and the next T line, each row is given a split number (length between 3 and 10000).
Output Description:
The output t row, which corresponds to the minimum number of copies of each string corresponding to each line in the input (allows leading 0).
Example 1
input
4
eight
zerotwoone
Ohwetenrteo
Ohewtiegthenrteo
Output
0
234
345
0345
2, Analysis: By analyzing each word of each character, in turn, find the first group, the second group ..., each word of each group can have a character and other words are different, so as to determine the existence of a word, and then delete the word, every time you delete the word on the occurrence of +1 times, indicating the number of occurrences of this word, To pave the back for the output results.
Note: Find out if the groups are ordered
3, code: Already a
Package schooloffer17;
Import Java.util.Arrays;
Import Java.util.Scanner; /** * @Author: Cxh * @CreateTime: 17/12/2 10:01 * @ProjectName: Javabasetest * < phone number-Avatar ></> * Public clas
s phonenumdevide {public static void main (string[] args) {Scanner scanner=new Scanner (system.in);
int n;
N=integer.valueof (Scanner.nextline (). Trim ());//n test Case int[] record=new int[10];
for (int i=0;i<n;i++) {String str=scanner.nextline (). Trim (). toLowerCase ();
Arrays.fill (record,0)//record number occurrences StringBuilder sb=new StringBuilder (str);
Phase 1//two->4 while (Sb.indexof ("W")!=-1) {Sb.deletecharat (Sb.indexof ("T"));
Sb.deletecharat (Sb.indexof ("w"));
Sb.deletecharat (Sb.indexof ("O"));
record[4]++; }//six->8 while (Sb.indexof ("x")!=-1) {Sb.deletecharat (Sb.indexoF ("S"));
Sb.deletecharat (Sb.indexof ("I"));
Sb.deletecharat (Sb.indexof ("X"));
record[8]++;
}//eight->0 while (Sb.indexof ("G")!=-1) {Sb.deletecharat (Sb.indexof ("E"));
Sb.deletecharat (Sb.indexof ("I"));
Sb.deletecharat (Sb.indexof ("G"));
Sb.deletecharat (Sb.indexof ("H"));
Sb.deletecharat (Sb.indexof ("T"));
record[0]++;
//zero->2 while (Sb.indexof ("z")!=-1) {Sb.deletecharat (Sb.indexof ("z"));
Sb.deletecharat (Sb.indexof ("E"));
Sb.deletecharat (Sb.indexof ("R"));
Sb.deletecharat (Sb.indexof ("O"));
record[2]++; //Phase 2//three->5 while (Sb.indexof ("H")!=-1) {Sb.deletecharat (sb.
IndexOf ("T")); Sb.deletecharat (Sb.indexof ("H "));
Sb.deletecharat (Sb.indexof ("R"));
Sb.deletecharat (Sb.indexof ("E"));
Sb.deletecharat (Sb.indexof ("E"));
record[5]++;
}//four->6 while (Sb.indexof ("U")!=-1) {Sb.deletecharat (Sb.indexof ("F"));
Sb.deletecharat (Sb.indexof ("O"));
Sb.deletecharat (Sb.indexof ("U"));
Sb.deletecharat (Sb.indexof ("R"));
record[6]++;
}//seven->9 while (Sb.indexof ("s")!=-1) {Sb.deletecharat (Sb.indexof ("s"));
Sb.deletecharat (Sb.indexof ("E"));
Sb.deletecharat (Sb.indexof ("V"));
Sb.deletecharat (Sb.indexof ("E"));
Sb.deletecharat (Sb.indexof ("n"));
record[9]++; }//Phase 3//five->7 while (Sb.indexof ("F")!=-1) {Sb.deletecharat (sb.i Ndexof ("F"));
Sb.deletecharat (Sb.indexof ("I"));
Sb.deletecharat (Sb.indexof ("V"));
Sb.deletecharat (Sb.indexof ("E"));
record[7]++; }//Phase 4//nine->1 while (Sb.indexof ("I")!=-1) {Sb.deletecharat (sb.i
Ndexof ("n"));
Sb.deletecharat (Sb.indexof ("I"));
Sb.deletecharat (Sb.indexof ("n"));
Sb.deletecharat (Sb.indexof ("E"));
record[1]++; }//Phase 5//one->3 while (Sb.indexof ("E")!=-1) {Sb.deletecharat (sb.in
Dexof ("O"));
Sb.deletecharat (Sb.indexof ("n"));
Sb.deletecharat (Sb.indexof ("E"));
record[3]++; for (int j=0;j<10;j++) {for (int k=0;k<record[j];k++) {sb.append (j)
;
} System.out.println (Sb.tostring ()); }
}
}