#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:268435456")
int main() {
  string st;
  cin >> st;
  const long long int N = 'J' - 'A';
  long long r = 0;
  bool b[N + 1];
  for (int i = 0; i < N + 1; i++) b[i] = 0;
  long long v = 10;
  int i = 0;
  if (((st[i] >= 'A') && (st[i] <= 'J')) || (st[i] == '?')) {
    r = 9;
    if ((st[i] >= 'A') && (st[i] <= 'J')) {
      b[st[i] - 'A'] = 1;
      v--;
    }
  } else
    r = 1;
  i++;
  long f = 0;
  for (; i < st.size(); i++) {
    if ((st[i] >= 'A') && (st[i] <= 'J'))
      if (b[st[i] - 'A'] == 0) {
        r *= v;
        v--;
        if (v == 0) v = 1;
        b[st[i] - 'A'] = 1;
      }
    if (st[i] == '?') f++;
  }
  cout << r;
  for (int i = 0; i < f; i++) cout << 0;
  return 0;
}
