#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[100010];
  cin >> str;
  int len = strlen(str);
  long long result = 1;
  int chp = 10;
  int zcount = 0;
  bool map[30] = {0};
  if (str[0] == '?') {
    result = 9;
  } else if (str[0] >= 'A') {
    result = 9;
    chp = 9;
    map[str[0] - 'A'] = 1;
  }
  for (int i = 1; i < len; i++) {
    if (str[i] == '?') {
      zcount++;
    } else if (str[i] >= 'A') {
      if (!map[str[i] - 'A']) {
        result *= chp;
        chp--;
        map[str[i] - 'A'] = 1;
      }
    }
  }
  cout << result;
  for (int i = 0; i < zcount; i++) cout << 0;
  cout << endl;
  return 0;
}
