1 #include <iostream>
2 #include <string>
3 #include <new>
4 #include <vector>
5 using namespace std;
6
7 inline int ji_suan( char &ch1,char &ch2 )
8 {
9 int j = ( ch1 - '0' ) * 10 + ( ch2 - '0' );
10 return j;
11 }
12 int main()
13 {
14 string str;
15 vector<int> v1;
16 while ( cin >> str && str != "0" )
17 {
18 for ( int i = 0; i != str.size(); ++i )
19 v1.push_back(0);
20 if ( str[0] - '0' >= 1 && str[0] - '0' <= 26 )
21 v1[0] = 1;
22 int i = 1;
23 for ( ; i != str.size(); ++i )
24 {
25 if ( ( i + 1 != str.size() && str[i+1] == '0' ) || str[i] == '0' || str[i-1] == '0' ) //判断 0 的情况
26 {
27 v1[i] = v1[i-1];
28 continue;
29 }
30 int j = ji_suan( str[i-1],str[i] );
31 if ( i == 1 && ( j >= 1 && j <= 26 ) ) // 然后 是一个 推的 过程 动动笔就明白了
32 v1[i] = v1[i-1] + 1;
33 else if ( i > 1 )
34 {
35 if ( j >= 1 && j <= 26 )
36 v1[i] = v1[i-1] + v1[i-2];
37 else v1[i] = v1[i-1];
38 }
39 else v1[i] = v1[i-1]; // 主要 是针对 i == 1 不成立的时候
40 }
41 cout << v1[i-1] << endl;
42 v1.clear();
43 }
44 return 0;
45 }
46