All submissions for this problem are available.
Venkatesh the coder has come up with an idea to rank his fellow coders. His idea is to use the first name of the coders and rank them according to his own ranking algorithm.
Suppose the first name of some coder is "duk"(Venkatesh does not like capital letters). Venkatesh then wrote all permutations of the letters of "duk" in descending order.
ukd, udk, kud, kdu, duk, dku.
Now he numbers each permutation serially from 1. The serial number alloted to "duk" is his rank. Here "duk" gets a number "5" according to this algorithm.
However, the job is not done. Venkatesh needs to enter the details of this coder in an excel sheet in the column corresponding to this number. Columns in an excel
sheet are numbered alphabetically (in upper-case) as A,B,C,D.....Z,AA,AB......and so on. For example, the row corresponding to this number would be 'E'.
Assume that an excel sheet can have a large number of columns i.e column numbers like AAA,GHTY,KIUGH are possible.
Kindly help Venkatesh to find out which column to store his fellow coder's name in.
The first line of the input contains an integer T(1<=T<=10) denoting the number of test cases.
The next T lines will be a string of lower-case characters representing a coder's name, for which you need to find out the column id.
Length of string will not exceed 10 characters.
For each name, you need to print a string of upper-case alphabets corresponding to the column, where the name of the coder will be placed according to this algorithm.
Example case 1. "duk" as shown above gets alloted a rank of 5. "abcde" will be the last element in the listing, so will be assigned a rank of 120; which when converted will fall into column DP.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions