#include <bits/stdc++.h>
using namespace std;
long long a[10000000];
char s[1000000];
char x;
long long n, k, kol, k1;
int main() {
  long long i = -1;
  while (cin >> x) {
    ++i;
    s[i] = x;
  }
  n = i;
  kol = 0;
  k1 = 0;
  for (int i = 0; i <= n; ++i) {
    if ((s[i] >= 'A') && (s[i] <= 'J')) {
      if (a[int(s[i]) - int('A')] != 1) ++kol;
      a[int(s[i]) - int('A')] = 1;
    } else if (s[i] == '?')
      ++k1;
  }
  k = 9;
  long long o1;
  if ((s[0] >= 'A') && (s[0] <= 'J'))
    o1 = 9;
  else
    o1 = 10;
  for (int i = 2; i <= kol; ++i) {
    o1 = o1 * k;
    --k;
  }
  long long o;
  if (s[0] != '?')
    o = 10;
  else
    o = 9;
  if ((kol > 0) && (k1 > 0)) {
    cout << o * o1;
    for (int i = 2; i <= k1; ++i) cout << '0';
  } else if (kol > 0)
    cout << o1;
  else if (k1 > 0) {
    cout << o;
    for (int i = 2; i <= k1; ++i) cout << '0';
  } else
    cout << 1;
  return 0;
}
