#include <bits/stdc++.h>
int main(void) {
  int len, i, numlet = 0;
  char s[100002], l[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  long long num = 1LL;
  int start = 10;
  int num10 = 0;
  scanf("%s", s);
  len = strlen(s);
  for (i = 0; i < len; i++) {
    if (s[i] == '?')
      (i == 0) ? num *= 9 : num10++;
    else if (s[i] >= 'A' && s[i] <= 'J')
      l[s[i] - 'A']++;
  }
  for (i = 0; i < 10; i++) {
    if (l[i] != 0) num *= (10 - numlet++);
  }
  if (s[0] >= 'A' && s[0] <= 'J') {
    num /= 10;
    num *= 9;
  }
  printf("%I64d", num);
  for (i = 0; i < num10; i++) printf("0");
  printf("\n");
  return 0;
}
