import java.util.*;


public class Solution {
    /**
     * 解码
     * @param nums string字符串 数字串
     * @return int整型
     */
    public int solve (String nums) {
        // write code here
        if (nums == null || nums.length() < 1) {
            return 0;
        }
        char[] arr = nums.toCharArray();
        int n = arr.length;
        int[] dp = new int[n];
        dp[0] = arr[0] == '0' ? 0 : 1;
        for (int i = 1; i < n; i++) {
            if (arr[i] != '0') {
                dp[i] = dp[i - 1];
            } 
            if (arr[i - 1] == '1' || (arr[i - 1] == '2' && arr[i] < '7')) {
                dp[i] += (i > 1 ? dp[i - 2] : 1);
            }
        }
        return dp[n - 1];
    }
}