class Solution
{
public:
    int titleToNumber(string s)
    {
        int sum = 0;
        int i = 0;
        for (i = 0; i < s.size() - 1; ++i)
        {
            sum = (sum + s[i] - 64) * 26;
        }
        sum += (s[i] - 64);
        return sum;
    }
};
