#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10, MOD = 100000000;
char str[MAXN];
int n, fac[100];
bool used[300];
int A(int n, int k) { return fac[n] / fac[n - k]; }
int main() {
  fac[0] = 1;
  for (int i = 1; i <= 10; ++i) fac[i] = fac[i - 1] * i;
  scanf("%s", str);
  n = strlen(str);
  int cnt = 0, tot = 0;
  for (int i = 0; i < n; ++i) {
    if (str[i] == '?' && i) ++tot;
    if (str[i] >= 'A' && str[i] <= 'J' && !used[str[i]])
      ++cnt, used[str[i]] = true;
  }
  int CC = 1;
  if (str[0] >= 'A' && str[0] <= 'J')
    CC *= A(10, cnt) - A(9, cnt - 1);
  else
    CC *= A(10, cnt);
  if (str[0] == '?') CC *= 9;
  cout << CC;
  for (int i = 1; i <= tot; ++i) printf("0");
  puts("");
  fclose(stdin);
  fclose(stdout);
  return 0;
}
