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
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>

inline int ti(char c)
{
    return c - '0';
}

inline int ti(char c1, char c2)
{
    return (c1 - '0') * 10 + c2 - '0';
}

int main()
{
    // preprocessing
    int mozliwosci[100] = {};
    
    for (int a = 0; a < 10; a++)
        for (int b = 0; b < 10; b++)
            mozliwosci[a + b]++;

    // input
    char n[20];

    scanf("%s", n);

    // solving
    int size = 1;
    long long rozw[20];
    
    rozw[0] = 1;
    rozw[1] = mozliwosci[ti(n[0])];
    
    while (n[size])
    {
        rozw[size+1] = rozw[size] * mozliwosci[ti(n[size])];
        if (n[size-1] != '0')
            rozw[size+1] += rozw[size-1] * mozliwosci[ti(n[size-1], n[size])];
        
        size++;
    }
    
    printf("%lld\n", rozw[size]);
    return 0;
}