#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 100000000;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int main() {
  string s;
  cin >> s;
  bool en[10] = {};
  for (int i = 0; i < (((int)(s).size())); i++)
    if ('A' <= s[i] && s[i] <= 'J') en[s[i] - 'A'] = true;
  int q_cnt = 0;
  for (int i = 0; i < (((int)(s).size())); i++)
    if (s[i] == '?') q_cnt++;
  long long ans = 1;
  int c = 10;
  for (int i = 0; i < (10); i++)
    if (en[i]) {
      ans *= c;
      c--;
    }
  if (q_cnt) {
    ans *= 10;
    q_cnt--;
  }
  if (('A' <= s[0] && s[0] <= 'J') || s[0] == '?') ans = ans / 10 * 9;
  printf("%I64d", ans);
  for (int i = 0; i < (q_cnt); i++) putchar('0');
  puts("");
  return 0;
}
