#include <bits/stdc++.h>
char a[100000];
int main() {
  int i, j, k, l, o, p, d[10000], pr, po, f;
  while (gets(a)) {
    for (j = 0; j <= 9; j++) {
      d[j] = 0;
    }
    l = strlen(a);
    for (j = 0; j < l; j++) {
      if (a[j] >= 'A' && a[j] <= 'J') {
        f = a[j] - 65;
        d[f]++;
      }
    }
    pr = 1;
    for (j = 0; j < l; j++) {
      if (a[j] == '?') pr = pr * 10;
    }
    po = 10;
    for (i = 0; i <= 9; i++) {
      if (d[i] >= 1) {
        pr = pr * po;
        po--;
      }
    }
    if (a[0] == '?' || (a[0] >= 'A' && a[0] <= 'J')) {
      pr = pr / 10 * 9;
    }
    printf("%d\n", pr);
  }
  return 0;
}
