#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = 3.1415926535897932384626433832795;
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
string str;
int let[30];
int main() {
  cin >> str;
  int n_q = 0;
  int n_let = 0;
  for (int i = 0; i < 30; ++i) {
    let[i] = 0;
  }
  for (int i = 0; i < str.length(); ++i) {
    if (str[i] == '?') {
      n_q++;
    } else if (str[i] >= 'A' && str[i] <= 'Z') {
      int t_let = str[i] - 'A';
      if (let[t_let] == 0) {
        let[t_let] = 1;
        n_let++;
      }
    }
  }
  if (n_let > 10) {
    cout << 0 << endl;
  } else {
    int m = 1;
    for (int i = 0; i < n_let; ++i) {
      m *= 10 - i;
    }
    if (str[0] >= 'A' && str[0] <= 'Z') {
      m = (m / 10) * 9;
    }
    if (str[0] == '?') {
      m *= 9;
      n_q--;
    }
    cout << m;
    for (int i = 0; i < n_q; ++i) {
      cout << "0";
    }
    cout << endl;
  }
  return 0;
}
