#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 解码
# @param nums string字符串 数字串
# @return int整型
#
class Solution:
    def con(self,last,this):
        c = [0,0]
        if 0<int(this)<=9:
            c[0]=1
        if 10<=int(last+this)<=26:
            c[1]=1
        return c

    def solve(self , nums: str) -> int:
        # write code here
        leng = len(nums)
        dp = [0 for i in range(leng)]
        if int(nums[0])==0:
            return 0
        dp[0] = 1
        for i in range(1,leng):
            this = nums[i]
            if i==1:
                last = nums[0]
                count = self.con(last,this)
                dp[i] = sum(count)
            else:
                last = nums[i-1]
                count = self.con(last,this)
                dp[i] = count[0]*dp[i-1] + count[1]*dp[i-2]
                    
        return dp[-1]