#include <bits/stdc++.h>
using namespace std;
map<char, pair<int, int> > mp;
char aa[1000007];
long long int exp(long long int a, long long int b) {
  if (b < 0) return 0;
  long long int tem = 1;
  while (b) {
    if (b % 2) tem = tem * a;
    a = a * a;
    b = b / 2;
  }
  return tem;
}
int main() {
  scanf("%s", aa);
  int lm = strlen(aa);
  int i;
  long long int ans = 1;
  for (i = 0; i < lm; i++) {
    mp[aa[i]].first++;
    if (mp[aa[i]].first == 1) mp[aa[i]].second = i;
  }
  int cur = 10;
  for (i = 'A'; i <= 'J'; i++) {
    if (mp[i].first) {
      if (!mp[i].second) {
        ans = ans * 9;
        cur--;
      }
    }
  }
  for (i = 'A'; i <= 'J'; i++)
    if (mp[i].first && mp[i].second) ans = ans * cur, cur--;
  if (mp['?'].first)
    if (!mp['?'].second)
      ans = ans * 9 * exp(10, mp['?'].first - 1);
    else
      ans = ans * exp(10, mp['?'].first);
  printf("%lld\n", ans);
  return 0;
}
