#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 解码
# @param nums string字符串 数字串
# @return int整型
#
class Solution:
    def solve(self , nums: str) -> int:
        # write code here
        if nums=="0":
            return 0
        if nums=="10" or nums=="20" or len(nums)==1:
            return 1
        for i in range(2,len(nums)):
            if nums[i]=="0":
                if nums[i-1]!="1" and nums[i-1]!="2":
                    return 0
        res=[1 for i in range(len(nums))]
        # res[0]=1
        res[1]=1 if int(nums[:2])>26 else 2
        for i in range(2,len(nums)):
            if nums[i]=="0":
                res[i]=res[i-2]
            else:
                if int(nums[i-1:i+1])>26 or int(nums[i-1:i+1])<10:
                    res[i]=res[i-1]
                else:
                    res[i]=res[i-2]+res[i-1]
        return res[-1]