【題目敘述】https://tioj.ck.tp.edu.tw/problems/1463
#include <bits/stdc++.h>
using namespace std;
long long dp[10005];
string s;
void solve(){
s = ' '+s;
for (int i = 1; i < s.length(); i++){
dp[i] = 0;
if (s[i] != '0') dp[i] += dp[i-1];
if (s[i-1] == '1' || (s[i-1] == '2' && s[i] <= '6')) dp[i] += dp[i-2];
if (dp[i] == 0){
cout << 0 << "\n";
return;
}
}
cout << dp[s.length()-1] << "\n";
}
int main(){
dp[0] = 1;
while (cin >> s){
if (s == "0") break;
solve();
}
}