Columns are a fundamental part of any spreadsheet program such as Microsoft Excel. Columns run vertically in a worksheet. Each column is identified by a capital Latin letters in the column header starting with column with identifier A and running through to column with identifier Z. After Z you get AA, AB, AC etc. until you get to AZ. Then it is BA, BB, BC, …, ZY, ZZ, AAA, AAB, …, AAZ, ABA, …, ZZY, ZZZ, AAAA, AAAB and so on… The last column is ZZZZZZZZZZ.
Recently Todor has learned how to work with Excel. Since then all that he do is giving integer indices to every possible column. Starting from the first column A (with index 1), through Z (with index 26), AA (with index 27), and so on. Of course this is a very, very hard and time-wasting job. You, as programmer, know that this can be solved easily with a computer program.
Help Todor by writing a program that converts excel column identifier to a column index.
static void Main()
long N = long.Parse(Console.ReadLine());
char chars = new char[N];
for (long i = 0; i < N; i++)
chars[i] = char.Parse(Console.ReadLine());
long arr = new long[N];
for (long j = 0; j < N; j++)
arr[j] = ((long)chars[j] - 64) * (long)Math.Pow(26, N - j - 1);