#include <iostream>
#include <vector>
#include <string>
using namespace std;
long long arr[5005];
long long dp[5005];
unsigned long n;
void solve(){
dp[0] = 1;
dp[1] = (arr[0] * 10 + arr[1] <= 26 && arr[0] != 0 && arr[1] != 1)? 2 : 1;
for(int i = 2; i < n; i++){
if(arr[i - 1] * 10 + arr[i] <= 26 && arr[i - 1] * 10 + arr[i] > 9) dp[i] = dp[i - 1] + dp[i - 2];
else dp[i] = dp[i - 1];
}
cout << dp[n - 1] << endl;
}
int main(){
string S;
while(cin >> S && S != "0"){
n = S.length();
for(int i = 0; i < n; i++)
arr[i] = S[i] - '0';
solve();
}
return 0;
}
It gives the same output as the sample test cases, am I missing some corner test cases? Any help would be appreciated, thanks.