#include <bits/stdc++.h>
using namespace std;
int main() {
  string x;
  map<char, bool> vis;
  long long res = 1;
  int size = 10, l = 0;
  cin >> x;
  for (char i = 'A'; i <= 'J'; i++) vis[i] = false;
  for (int i = 0; i < x.size(); i++) {
    if (x[i] == '?' && i != 0) {
      l++;
    } else if (x[i] == '?' && i == 0)
      res *= 9;
    else if (!vis[x[i]]) {
      if (x[i] >= 'A' && x[i] <= 'J') {
        if (i != 0)
          res *= size;
        else
          res *= 9;
        size--;
      }
      vis[x[i]] = true;
    }
  }
  stringstream ss;
  x.clear();
  ss << res;
  ss >> x;
  for (int i = 0; i < l; i++) x += '0';
  cout << x << endl;
  return 0;
}
