#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
const double eps = 1e-9;
const double pi = acos(-1.0);
const long long inf = 1ll << 60;
const int mod = 1e9 + 7;
bool M[11];
int main() {
  string s;
  cin >> s;
  memset((M), (false), sizeof(M));
  int ans = 1, cnt = 0;
  for (int i = 0, p = 10; i < (int)(s).size(); i++) {
    if (s[i] >= 'A' and s[i] <= 'J') {
      if (!M[s[i] - 'A']) {
        if (i == 0)
          ans *= --p;
        else
          ans *= p--;
      }
      M[s[i] - 'A'] = true;
    }
    if (s[i] == '?') {
      if (i == 0)
        ans *= 9;
      else
        ++cnt;
    }
  }
  printf("%d", ans);
  for (int i = 0; i < cnt; i++) printf("0");
  printf("\n");
  return 0;
}
