Decode Ways II




Hi, In the last lined in the below snippet, I believe it should be 17 instead of 15. Since, given that first char is * and second char is *, total no of 2 digit characters are 10,11...26 = 17 (K, L, M, N, O, ....Z)
Please correct if wrong
if (s.charAt(i) == '*') { second = 9 * second; if (s.charAt(i  1) == '1') second = (second + 9 * first) % M; else if (s.charAt(i  1) == '2') second = (second + 6 * first) % M; else if (s.charAt(i  1) == '*') second = (second + 15 * first) % M; }

class Solution {
public:
int maxMod;
int numDecodings(string s) {
maxMod = 1000000007;
//vector<int> dp(s.size(), 1);
if (s.size() == 0)
return 0;
if (s.size() == 1)
return getSValue(s[0]);
if (s.size() == 2)
return getValue(s[0], s[1]) + getSValue(s[0])getSValue(s[1]);
long lastOne = getSValue(s[s.size()1]);
long lastTwo= getValue(s[s.size()2], s[s.size()1]) + getSValue(s[s.size()2])getSValue(s[s.size()1]);
for (int i = s.size()  3; i >= 0; i)
{
long cur = ((getSValue(s[i])lastTwo) % maxMod + (getValue(s[i], s[i + 1])lastOne) % maxMod) % maxMod;
lastOne = lastTwo;
lastTwo = cur;
}
return lastTwo;
}
long getValue(char x, char y)
{
if (x == '0')
return 0;
if (x != ''&&y != '')
{
if ((x  '0') * 10 + y  '0' <= 26)
return 1;
else
return 0;
}
else
{
if (x != '')
{
switch (x)
{
case '1':return 9;
case '2':return 6;
default:return 0;
break;
}
}
else
{
if (y != '')
{
if (y  '0' < 7)
return 2;
else
return 1;
}
else
return 15;
}
}
}
long getSValue(char x)
{
if (x != ''&&x != '0')
return 1;
if (x == '')
return 9;
return 0;
}
};

@Arkkun
Pls double check the description: the character '*', which can be treated as one of the numbers from 1 to 9. can't be '0'.