#include <bits/stdc++.h>
using namespace std;
char a[200010];
int main() {
  while (~scanf("%s", a)) {
    bool rec[20];
    memset(rec, false, sizeof(rec));
    long long ans = 1;
    int len = strlen(a);
    int ques = 0;
    for (int i = 0; i < len; i++) {
      if (a[i] == '?') ques++;
      if (a[i] <= 'J' && a[i] >= 'A') rec[a[i] - 'A'] = true;
    }
    if (a[0] <= 'J' && a[0] >= 'A') {
      ans *= 9;
      rec[a[0] - 'A'] = false;
      long long tot = 9;
      for (int i = 0; i < 10; i++)
        if (rec[i]) {
          ans *= tot;
          tot--;
        }
    } else {
      long long tot = 10;
      for (int i = 0; i < 10; i++)
        if (rec[i]) {
          ans *= tot;
          tot--;
        }
    }
    if (ques != 0 && a[0] == '?') {
      ans *= 9;
    } else if (ques != 0 && a[0] != '?') {
      ans *= 10;
    }
    char rev[100];
    int cnt = 0;
    while (ans) {
      rev[cnt++] = ans % 10 + '0';
      ans /= 10;
    }
    for (int i = cnt - 1; i >= 0; i--) printf("%c", rev[i]);
    for (int i = 0; i < ques - 1; i++) printf("0");
    puts("");
  }
}
