#include <bits/stdc++.h>
using namespace std;
int _;
string s;
set<char> p;
int main() {
  cin >> s;
  int n = ((int)(s).size());
  long long ans = 1;
  int ten = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '?') {
      if (i != 0)
        ++ten;
      else
        ans *= 9;
    } else if ('A' <= s[i] && s[i] <= 'J') {
      if (p.find(s[i]) == p.end()) {
        ans *= (10 - ((int)(p).size()) - (i == 0));
      }
      p.insert(s[i]);
    }
  }
  cout << ans << string(ten, '0') << endl;
  return 0;
}
