using System;
public class Test
{
private const int NumbersOfLettersInAlphabet = 26;
public static void Main()
{
Console.WriteLine(ExcelNumerationToDecimal("AB"));
}
public static int ExcelNumerationToDecimal(string columnName)
{
var columnNumber = 0;
for (var i = 0; i < columnName.Length; i++)
{
columnNumber += (columnName[columnName.Length - i - 1] - '@') * (int)Math.Pow(NumbersOfLettersInAlphabet, i);
}
return columnNumber;
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIFRlc3QKewogICAgICAgIHByaXZhdGUgY29uc3QgaW50IE51bWJlcnNPZkxldHRlcnNJbkFscGhhYmV0ID0gMjY7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKICAgICAgICB7CiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKEV4Y2VsTnVtZXJhdGlvblRvRGVjaW1hbCgiQUIiKSk7CgogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBpbnQgRXhjZWxOdW1lcmF0aW9uVG9EZWNpbWFsKHN0cmluZyBjb2x1bW5OYW1lKQogICAgICAgIHsKICAgICAgICAgICAgdmFyIGNvbHVtbk51bWJlciA9IDA7CiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY29sdW1uTmFtZS5MZW5ndGg7IGkrKykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgY29sdW1uTnVtYmVyICs9IChjb2x1bW5OYW1lW2NvbHVtbk5hbWUuTGVuZ3RoIC0gaSAtIDFdIC0gJ0AnKSAqIChpbnQpTWF0aC5Qb3coTnVtYmVyc09mTGV0dGVyc0luQWxwaGFiZXQsIGkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBjb2x1bW5OdW1iZXI7CiAgICAgICAgfQp9