In excel sheets there are multiple rows and columns. The rows are numbered like 1, 2, 3…
The columns are numbered like A, B, C,…X, Y, Z, AA, AB,...AY, AZ, BA,...ZY, ZZ, AAA, AAB,...
Here the column numbers denote the following:
A => 1
B => 2
C => 3
.
.
.
X => 24
Y => 25
Z => 26
.
.
Given an excel column number, find the numerical column number.
Z => 26
AA => 27
ABCA => 19007
First-line contains ‘T’ denoting the number of test cases.
For each test-case, one line containing a string denoting the column number.
For each test-cases, print a number denoting excel column number.
2
Z
ABCA
26
19007
2
ABC
AAB
731
704
1 <= t <= 1000
1 <= Length of column name <= 6
Note: Column names will be in uppercase English letters.