#include <bits/stdc++.h>
using namespace std;
char str[100011];
int main() {
  bool type[26];
  int cnt = 0, q = 0;
  scanf("%s", str);
  memset(type, 0, sizeof(type));
  for (int i = 0; str[i] != '\0'; i++) {
    if (str[i] == '?')
      q += 1;
    else if ('A' <= str[i] && str[i] <= 'J') {
      if (type[str[i] - 'A'] == false) {
        cnt++;
        type[str[i] - 'A'] = true;
      }
    }
  }
  unsigned long long ans = 1;
  if (cnt > 0) {
    unsigned long long f = 10;
    if ('A' <= str[0] && str[0] <= 'J') f = 9;
    for (int i = 1; i < cnt; i++) {
      f *= 10 - i;
    }
    ans *= f;
  }
  if (q > 0) {
    unsigned long long f = 10;
    if (str[0] == '?') f = 9;
    for (int i = 1; i < q; i++) {
      f *= 10;
    }
    ans *= f;
  }
  printf("%I64u\n", ans);
  return 0;
}
