#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
char s[maxn];
bool cdig[10];
int main(int argc, char **argv) {
  scanf("%s", s);
  int n = strlen(s);
  int zeros = 0;
  int count = 10;
  int ans = 1;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '?') {
      if (i == 0) {
        ans *= 9;
      } else {
        ++zeros;
      }
    } else if (s[i] >= 'A' && s[i] <= 'J') {
      int dig = s[i] - 'A';
      if (!cdig[dig]) {
        if (i == 0) {
          ans *= 9;
        } else {
          ans *= count;
        }
        --count;
        cdig[dig] = true;
      }
    }
  }
  printf("%d", ans);
  for (int i = 0; i < zeros; ++i) {
    printf("0");
  }
  printf("\n");
  return 0;
}
