#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  set<char> d;
  int zer = 0;
  for (char c : s) {
    if ('A' <= c && c <= 'Z') {
      d.insert(c);
    } else if (c == '?')
      zer++;
  }
  long long p = 1;
  for (long long i = 1; i <= d.size(); i++) p *= (11 - i);
  if (('A' <= s[0] && s[0] <= 'Z')) p = p / 10 * 9;
  if (s[0] == '?') {
    zer--;
    p *= 9;
  }
  cout << p;
  while (zer--) {
    cout << 0;
  }
  cout << endl;
}
