class Solution:
    def solve(self , nums: str) -> int:
        # write code here
        l = len(nums)
        dp = [1 for _ in range(l+1)]
        for i in range(1, l+1):
            if i == 1:
                if nums[i-1] == '0':
                    dp[i] = 0
                else:
                    dp[i] = 1
            else:
                if nums[i-1] == '0' and int(nums[i-2]) > 2:
                    return 0
                elif nums[i-1] == '0' or nums[i-2] == '0' or int(nums[i-2]+nums[i-1]) < 1 or int(nums[i-2]+nums[i-1]) > 26:
                    dp[i] = dp[i-1]
                else:
                    dp[i] = dp[i-2] + dp[i-1]
                    
        return dp[-1]