class Solution: def solve(self , nums ): # write code here cur = 0 if nums[-1] == '0' else 1 prev = 1 pprev = 0 for i in range(len(nums)-2, -1, -1): pprev = prev prev = cur if nums[i] == '0': cur = 0 else: cur = prev if 0 < int(nums[i: i+2]) <= 26: cur += pprev return cur