#include <bits/stdc++.h>
using namespace std;
bool a[10];
int main() {
  string str;
  cin >> str;
  int m(1);
  int cnt(10);
  int counter(0);
  if (str[0] == '?') {
    m *= 9;
  } else if (isalpha(str[0])) {
    m *= 9;
    cnt--;
    a[str[0] - 'A'] = true;
  }
  for (int i = 1; i < str.length(); i++) {
    if (cnt > 0 && isalpha(str[i]) && !a[str[i] - 'A']) {
      m *= cnt;
      cnt--;
      a[str[i] - 'A'] = true;
    }
    if (str[i] == '?') {
      counter++;
    }
  }
  printf("%d", m);
  for (int i = 0; i < counter; i++) {
    printf("0");
  }
  printf("\n");
  return 0;
}
