public static int numDecodings(String s) {
        if(s == null || s.length() == 0) return 0;
        int[] num = new int[s.length() + 1];
        num[0] = 1;
        if(s.charAt(0) != '0')num[1] = 1;
        for(int i = 1; i < s.length(); i++){
        	char ch1 = s.charAt(i - 1);
        	char ch2 = s.charAt(i);
        	if(ch2 != '0') num[i+1] = num[i];
        	if(ch1 == '1' || (ch1 == '2' && ch2 >= '0' && ch2 <= '6'))
        		num[i+1] += num[i-1];
        }
        return num[s.length()];
    }