数据量远远不止 500.
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
#define MAXN 10005
int main()
{
string str;
int dp[MAXN];
while(cin>>str && str != "0")
{
int len = str.size();
memset(dp,0,sizeof(dp));
dp[0] = 1;
dp[1] = 1;
for(int i = 2;i <= len;++i)
{
if(str[i-1] != '0')
dp[i] += dp[i-1];
if(str[i-2] == '1' || (str[i-2] == '2' && str[i-1] < '7'))
dp[i] += dp[i-2];
}
cout<<dp[len]<<endl;
}
return 0;
}