#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string str;
  cin >> str;
  int n = (int)str.length();
  long long cnt = 0, f = 0, sum = 1, j = 10, f1 = 0;
  long long hash[26] = {0};
  for (int i = (int)(0); i <= (int)(n - 1); i++) {
    if (str[i] == '?') {
      if (i == 0)
        f = 9;
      else
        cnt++;
    }
    if (str[i] >= 'A' && str[i] <= 'Z') {
      hash[str[i] - 'A']++;
      if (i == 0) f1 = 1;
    }
  }
  for (int i = (int)(0); i <= (int)(10); i++) {
    if (hash[i] > 0) {
      if (f1 == 1) {
        sum = sum * 9;
        j--;
        f1 = 0;
      } else {
        sum = sum * j;
        j--;
      }
    }
  }
  if (f > 0) {
    sum = sum * f;
  }
  cout << sum;
  for (int i = (int)(1); i <= (int)(cnt); i++) {
    cout << "0";
  }
  cout << "\n";
}
