#include <bits/stdc++.h>
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
using namespace std;
int main() {
  long long int i, j, j1 = 0, k, n, cnt = 10, flag = 1;
  char s[100001];
  cin >> s;
  k = 1;
  n = strlen(s);
  long long int a[10] = {0};
  for (i = 0; i < n; i++) {
    if (s[i] == '?') {
      if (i == 0)
        k *= 9;
      else
        j1++;
    } else if (s[i] >= 'A' && s[i] <= 'J') {
      if (i == 0) {
        a[s[i] - 'A'] = 1;
        k *= 9;
        cnt--;
      } else {
        if (!a[s[i] - 'A']) {
          k *= cnt;
          cnt--;
          a[s[i] - 'A'] = 1;
        }
      }
    }
  }
  cout << k;
  for (i = 0; i < j1; i++) cout << "0";
  return 0;
}
