#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param S string字符串
# @return int整型
#
class Solution:
def getNumber(self, S: str) -> int:
# write code here
'''alp, ans, S = "abcdefghijklmnopqrstuvwxyz", 0, S[::-1]
for i in range(len(S)):
ans += (alp.index(S[i])+1)*26**i'''
alp, ans = "abcdefghijklmnopqrstuvwxyz", 0
for c in S:
ans = ans*26+alp.index(c)+1
return ans
#类似26进制转化为10进制



京公网安备 11010502036488号