#include <bits/stdc++.h>
using namespace std;
int arr[2][2][2][2][2][2][2][2][2][2] = {0};
int arr2[1024] = {0};
int MOD = 1000000007;
string intToString(long long i) {
  std::stringstream ss;
  std::string s;
  ss << i;
  s = ss.str();
  return s;
}
string countCodes(string s) {
  set<char> diff;
  long long res = 1;
  long long count = 0;
  long long diffCount = 0;
  int n = s.size();
  bool used = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == '?') {
      if (i == 0) {
        res *= 9;
      } else {
        count++;
      }
    } else if (s[i] >= 'A' && s[i] <= 'Z') {
      diff.insert(s[i]);
      if (i == 0) {
        res *= 9;
        used = true;
      }
      if (diff.size() > 10) break;
    }
  }
  long long num = 10;
  for (int i = 0; i < diff.size(); i++) {
    if (num < 0) break;
    if (!used) {
      res *= num;
      used = false;
    }
    used = false;
    num--;
  }
  string sRes = intToString(res);
  if (res != 0) {
    for (int i = 0; i < count; i++) {
      sRes.push_back('0');
    }
  }
  return sRes;
}
int main(int argc, char* argv[]) {
  string s;
  cin >> s;
  string res = countCodes(s);
  cout << res;
  return 0;
}
