#include <bits/stdc++.h>
using namespace std;
bool have[50];
int main() {
  string S;
  cin >> S;
  int marks = 0, cntL = 0;
  long long part_ans = 1;
  for (int i = 0; i < (int)S.size(); ++i) {
    if (S[i] == '?')
      marks++;
    else if (S[i] >= 'A' && S[i] <= 'J' && !have[S[i] - 'A']) {
      have[S[i] - 'A'] = true;
      cntL++;
    }
  }
  if (S[0] >= 'A' && S[0] <= 'J')
    part_ans *= 9;
  else if (cntL)
    part_ans *= 10;
  for (int i = 2; i <= cntL; ++i) part_ans *= 10 - (i - 1);
  if (S[0] == '?') {
    marks--;
    part_ans *= 9;
  }
  cout << part_ans;
  for (int i = 1; i <= marks; ++i) cout << 0;
  cout << "\n";
  return 0;
}
