#include <bits/stdc++.h>
using namespace std;
static const int INF = 500000000;
template <class T>
void debug(T a, T b) {
  for (; a != b; ++a) cerr << *a << ' ';
  cerr << endl;
}
int n;
char s[100005];
int appear[15];
int main() {
  scanf("%s", s);
  n = strlen(s);
  int q = 0;
  for (int i = 0; i < n; ++i)
    if (s[i] >= 'A' && s[i] <= 'J') {
      appear[s[i] - 'A'] = 1;
    }
  for (int i = 0; i < n; ++i)
    if (s[i] == '?') ++q;
  int cnt = 0;
  for (int i = 0; i < 10; ++i)
    if (appear[i]) ++cnt;
  int res = 1;
  if (s[0] >= 'A' && s[0] <= 'J') {
    for (int i = 0; i < cnt; ++i) res *= 10 - i;
    res /= 10;
    res *= 9;
  } else {
    for (int i = 0; i < cnt; ++i) res *= 10 - i;
  }
  if (s[0] == '?') {
    res *= 9;
    --q;
  }
  printf("%d", res);
  for (int i = 0; i < q; ++i) putchar('0');
  puts("");
  return 0;
}
