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