1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <string>
#include <iostream>
using namespace std;

int cnt[222];
int dp[22];

int main() {
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cnt[i+j]++;
    }
  }
  string n;
  cin >> n;
  dp[0] = 1;
  dp[1] = cnt[n[0] - '0'];
  for (int i = 1; i < (int)n.size(); i++) {
    dp[i+1] = dp[i] * cnt[n[i] - '0'] + dp[i-1] * cnt[(n[i-1] - '0') * 10 + n[i] - '0'];
  }
  cout << dp[n.size()] << endl;
}