import java.util.*;


public class Solution {
    // 求编码结果的种类总数!
    public int solve (String nums) {
        int n = nums.length();
        int[] dp = new int[n+1]; 
        Arrays.fill(dp,1);
        for(int i = 2; i <= n; i++){
            if((nums.charAt(i-2) == '1' && nums.charAt(i-1) != '0') || (nums.charAt(i-2) == '2' && nums.charAt(i-1) > '0' && nums.charAt(i-1) <= '6')){
                dp[i] = dp[i-1] + dp[i-2];
            }else if( nums.charAt(i-2) > '2' && nums.charAt(i-1) == '0' ) {
                return 0;
            }else {
                dp[i] = dp[i-1];
            }
        }
        return dp[n];
    }
}