# https://leetcode.com/problems/excel-sheet-column-number/
# Tags: easy, math

class Solution:
    def titleToNumber(self, s: str) -> int:
        result = 0
        base = 1
        for i in range(0, len(s)):
            num = ord(s[len(s) - i - 1]) - ord('A') + 1
            result += num * base
            base *= 26

        return result


def test_1():
    assert Solution().titleToNumber('A') == 1

def test_2():
    assert Solution().titleToNumber('AB') == 28

def test_3():
    assert Solution().titleToNumber('ZY') == 701

005b259554c36303be2c38486db40b88019de46a
class Solution:

    def titleToNumber(self, s: str) ->int:
        result = 0
        base = 1
        for i in range(0, len(s)):
            num = ord(s[len(s) - i - 1]) - ord('A') + 1
            result += num * base
            base *= 26
        return result


<mask token>

class Solution:

    def titleToNumber(self, s: str) ->int:
        result = 0
        base = 1
        for i in range(0, len(s)):
            num = ord(s[len(s) - i - 1]) - ord('A') + 1
            result += num * base
            base *= 26
        return result


<mask token>


def test_3():
    assert Solution().titleToNumber('ZY') == 701

class Solution:

    def titleToNumber(self, s: str) ->int:
        result = 0
        base = 1
        for i in range(0, len(s)):
            num = ord(s[len(s) - i - 1]) - ord('A') + 1
            result += num * base
            base *= 26
        return result


<mask token>


def test_2():
    assert Solution().titleToNumber('AB') == 28


def test_3():
    assert Solution().titleToNumber('ZY') == 701

class Solution:

    def titleToNumber(self, s: str) ->int:
        result = 0
        base = 1
        for i in range(0, len(s)):
            num = ord(s[len(s) - i - 1]) - ord('A') + 1
            result += num * base
            base *= 26
        return result


def test_1():
    assert Solution().titleToNumber('A') == 1


def test_2():
    assert Solution().titleToNumber('AB') == 28


def test_3():
    assert Solution().titleToNumber('ZY') == 701

# https://leetcode.com/problems/excel-sheet-column-number/
# Tags: easy, math

class Solution:
    def titleToNumber(self, s: str) -> int:
        result = 0
        base = 1
        for i in range(0, len(s)):
            num = ord(s[len(s) - i - 1]) - ord('A') + 1
            result += num * base
            base *= 26

        return result


def test_1():
    assert Solution().titleToNumber('A') == 1

def test_2():
    assert Solution().titleToNumber('AB') == 28

def test_3():
    assert Solution().titleToNumber('ZY') == 701
