Given a column title as appear in an Excel sheet, return its corresponding column number.

For example:


    A -> 1
    B -> 2
    C -> 3
    ...
    Z -> 26
    AA -> 27
    AB -> 28 
    ...


Example 1:


Input: "A"
Output: 1


Example 2:


Input: "AB"
Output: 28


Example 3:


Input: "ZY"
Output: 701

Difficulty: introductory

Starter code:

class Solution:
    def titleToNumber(self, s: str) -> int:
        

Solutions:
class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         r, t = 0, 1
         for i in s:
             r = r*26 +(ord(i)-64)
             #t *= 26
         return r

class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         res = 0
         for i in s:
             res = res*26 + ord(i) - ord('A')+1
         return res

class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         res = 0
         for i in s:
             res *= 26
             res += ord(i) - ord("A") + 1
         return res    
             
             
             
             


class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         result = 0
         for char in s:
             result *= 26
             result += ord(char) - ord('A') + 1
         return result

class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         return 0 if len(s) == 0 else ord(s[-1]) - ord('A') + 1 + 26 * self.titleToNumber(s[:len(s)-1])

class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         if s == "":
             return 0
         return self.titleToNumber(s[:-1])*26 + ord(s[-1]) - ord('A') + 1

class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         s = s[::-1]
         sum = 0
         for exp, char in enumerate(s):
             sum += (ord(char) - 65 + 1) * (26 ** exp)
         return sum
         


class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         s = [ord(c)-64 for c in s]
         result = 0
         x = len(s) - 1
         for i in range(0, len(s)):
             result += (s[x - i] * (26**i))
         return result

class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         """
         val = ord('A')
         length = len(s)
         sum = 0
         for i in range(length):
             sum = sum + (ord(s[i])-val+1)* 26**(length-1-i)
         return sum

class Solution:
     def titleToNumber(self, s):
         """
         :type s: str
         :rtype: int
         
         
         """
         s = s[::-1]
         res = 0
         for exp, c in enumerate(s):
             res += (ord(c)-65 + 1) * (26 ** exp)
         return res