import java.util.*;

public class Solution { /** * 解码 * @param nums string字符串 数字串 * @return int整型 */ public int solve (String nums) { if(nums.length() == 0 || nums.charAt(0) == '0') return 0; int[] dp = new int[nums.length()]; dp[0] = 1; for(int i = 1; i < dp.length; i++){ if(nums.charAt(i) != '0'){ dp[i] = dp[i-1]; } // 3 2 4 int num = (nums.charAt(i-1)-'0')*10 + (nums.charAt(i)-'0'); if(num >= 10 && num <= 26){ if(i == 1){ dp[i] += 1; }else{ dp[i] += dp[i-2]; } } } return dp[nums.length()-1];

}

}