#include <bits/stdc++.h>
using namespace std;
char s[115111];
bool f[300];
int main() {
  scanf("%s", s);
  int l = strlen(s);
  long long cnt = 0, t = 0;
  for (int i = 0; i < l; i++) {
    if (s[i] == '?')
      cnt++;
    else if (s[i] >= 'A' && s[i] <= 'J' && f[s[i]] == false) {
      t++;
      f[s[i]] = true;
    }
  }
  long long ans = 1;
  for (long long i = 1; i <= t; i++) ans *= (11 - i);
  if (s[0] >= 'A' && s[0] <= 'J') {
    long long delta = 1;
    for (long long i = 1; i < t; i++) delta *= (10 - i);
    ans -= delta;
  }
  if (s[0] == '?') {
    ans *= 9;
    cnt--;
  }
  printf("%I64d", ans);
  while (cnt--) printf("0");
  printf("\n");
  return 0;
}
