Problem 86
Excel Column Number
Problem
Spreadsheet columns are named A, B, ..., Z, then AA, AB, ..., AZ, BA, ..., ZZ, then AAA, and so on. Column A is number 1, Z is 26, AA is 27, AB is 28 and ZZ is 702. Given a column title, print its column number. The title works like a base-26 number with the digits A = 1 to Z = 26 (there is no zero digit). Read it from left to right and update result = result × 26 + value of the letter.
Input
A single string of uppercase letters.
Output
Print the column number.
Constraints
1 <= length <= 7
Example input
A
Example output
1
Explanation
The title "A" has a single letter, whose value is 1, so it is column 1. As another example, AB = 1 × 26 + 2 = 28.