#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  getline(cin, s);
  long long int output = 1;
  int question_mark = 0;
  vector<int> alph_count(10);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '?')
      question_mark++;
    else if (isdigit(s[i]))
      continue;
    else {
      int ascii_value = s[i];
      alph_count[ascii_value - 65]++;
    }
  }
  int alph_oc = 0;
  bool first_alph = false;
  for (int i = 0; i < 10; i++)
    if (alph_count[i] > 0) alph_oc++;
  if (s[0] == '?') {
    output *= 9;
    question_mark--;
  }
  while (question_mark > 0) {
    output *= 10;
    question_mark--;
  }
  if (!isdigit(s[0]) && s[0] != '?') {
    first_alph = true;
    output *= 9;
    alph_oc--;
  }
  int start = 10;
  if (first_alph) start = 9;
  for (int i = 0; i < alph_oc; i++) output *= start - i;
  cout << output << endl;
  return 0;
}
