#include <bits/stdc++.h>
char s[100010];
int tag[10];
int main(void) {
  int flag = 0;
  int m, i, n, count;
  m = n = 0;
  count = 1;
  gets(s);
  int len;
  if (isalpha(s[0]))
    flag = 1;
  else if (s[0] == '?')
    flag = 2;
  for (len = strlen(s), i = 0; i < len; i++) {
    if (isalpha(s[i]) && tag[s[i] - 'A'] == 0) {
      m++;
      tag[s[i] - 'A'] = 1;
    } else if (s[i] == '?')
      n++;
  }
  for (i = 0; i < m; i++) {
    if (flag == 1) {
      count *= (10 - i - flag);
      flag = 0;
    } else
      count *= 10 - i;
  }
  if (flag == 2)
    for (count *= 9, i = 0; i < n - 1; i++) count *= 10;
  else
    for (i = 0; i < n; i++) count *= 10;
  printf("%d\n", count);
  return 0;
}
