1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>

using namespace std;

long long w[1000];
inline long long cti(char c){
    return (int)(c-'0');
};
inline  long long dwa(int w){
    if(w>=10 && w<=18){
        return 19-w;
    }else{
        return 0;
    }
}
int main() {
    string s;
    cin>>s;
    int len = s.size();
    if(len==1){
        w[0] = cti(s[len-1])+1;
        cout<<w[0]<<"\n";
        return 0;
    }
    w[0] = cti(s[len-1])+1;
    w[1] = (cti(s[len-2])+1)*w[0]+dwa(cti(s[len-2])*10+cti(s[len-1]));
    int j = 2;
    for(int i = len-3;i>=0;i--){
        w[j]=(cti(s[i])+1)*w[j-1] + dwa(cti(s[i])*10+cti(s[i+1]))*w[j-2];
        j++;
    }
    cout<<w[j-1]<<"\n";
    return 0;
}