#include <bits/stdc++.h>
using namespace std;
int c(int n, int k) {
  long long res = 1;
  for (int i = n - k + 1; i <= n; ++i) res *= i;
  return res;
}
int main() {
  string s;
  cin >> s;
  long long ans = 1;
  int q = 0;
  char used[26] = {false};
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] - 'A' >= 0 && s[i] - 'A' < 10 && !used[s[i] - 'A']) {
      used[s[i] - 'A'] = true;
      ++q;
    } else if (s[i] == '?')
      ans *= 10;
  }
  ans *= c(10, q);
  if (s[0] == '?')
    ans = ans / 10 * 9;
  else if (s[0] - 'A' >= 0 && s[0] - 'A' < 10)
    ans = ans / 10 * 9;
  cout << ans;
}
