#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
const double eps = 1e-9;
const double pi = 4 * atan(double(1));
const int N = int(1e5);
char s[N + 100];
bool used[20];
long long f[20];
long long c[20][20];
int main() {
  gets(s);
  int n = strlen(s);
  for (int i = 0; i <= 10; i++) {
    c[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }
  }
  f[0] = 1;
  for (int i = 1; i <= 10; i++) {
    f[i] = f[i - 1] * i;
  }
  if (s[0] == '?') {
    long long ans = 9;
    int len = 0;
    for (int i = 1; i < n; i++) {
      if (s[i] == '?') {
        len++;
      }
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] >= 'A' && s[i] <= 'J' && !used[s[i] - 'A']) {
        cnt++;
        used[s[i] - 'A'] = true;
      }
    }
    ans *= c[10][cnt] * f[cnt];
    printf("%I64d", ans);
    for (int i = 0; i < len; i++) {
      printf("0");
    }
    puts("");
    return 0;
  }
  if (s[0] >= 'A' && s[0] <= 'J') {
    long long ans = 1;
    int len = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '?') {
        len++;
      }
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] >= 'A' && s[i] <= 'J' && !used[s[i] - 'A']) {
        cnt++;
        used[s[i] - 'A'] = true;
      }
    }
    ans *= c[9][1] * c[9][cnt - 1] * f[cnt - 1];
    printf("%I64d", ans);
    for (int i = 0; i < len; i++) {
      printf("0");
    }
    puts("");
    return 0;
  }
  long long ans = 1;
  int len = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '?') {
      len++;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'A' && s[i] <= 'J' && !used[s[i] - 'A']) {
      cnt++;
      used[s[i] - 'A'] = true;
    }
  }
  ans *= c[10][cnt] * f[cnt];
  printf("%I64d", ans);
  for (int i = 0; i < len; i++) {
    printf("0");
  }
  puts("");
  return 0;
}
