#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007, dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
const double eps = 1e-8;
void read(int &k) {
  k = 0;
  char x = getchar();
  while (x < '0' || x > '9') x = getchar();
  while (x >= '0' && x <= '9') {
    k = k * 10 - 48 + x;
    x = getchar();
  }
}
map<int, int> A;
int n, ret, now, tot;
char s[100010];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++)
    if (s[i] >= 'A' && s[i] <= 'J')
      A[s[i]]++;
    else if (s[i] == '?')
      tot++;
  ret = 1;
  int t = A.size();
  now = 10;
  if (s[0] >= 'A' && s[0] <= 'J') {
    t = A.size();
    t--;
    ret *= 9;
    now = 9;
  } else if (s[0] == '?') {
    ret *= 9;
    tot--;
  }
  while (t) ret *= now, now--, t--;
  cout << ret;
  for (int i = 0; i < tot; i++) cout << "0";
  cout << endl;
  return 0;
}
