#include <bits/stdc++.h>
using namespace std;
map<char, int> mp;
int main() {
  string str;
  int cntq = 0, cntl = 10;
  cin >> str;
  long long res = 1;
  for (int i = 0; i < str.size(); i++) {
    if (isupper(str[i])) {
      if (mp.find(str[i]) == mp.end())
        mp[str[i]] = 1;
      else
        mp[str[i]] += 1;
    } else if (str[i] == '?')
      cntq++;
  }
  if (str[0] == '?') {
    res *= 9;
    if (cntq > 0) cntq--;
  } else if (isupper(str[0])) {
    res *= 9;
    cntl--;
    mp[str[0]] = 0;
  }
  for (char ch = 'A'; ch <= 'J'; ch++) {
    if (mp.find(ch) != mp.end() && mp[ch] > 0) {
      res *= cntl;
      cntl--;
    }
  }
  cout << res;
  for (int i = 1; i <= cntq; i++) cout << '0';
  cout << endl;
}
