#include <bits/stdc++.h>
using namespace std;
char s[(int)1e5 + 1];
int cc[26];
int main() {
  scanf("%s", s);
  for (int i = 0; i < 26; ++i) cc[i] = 0;
  int n = strlen(s);
  long long ans = 1;
  int countAlphabet = 0;
  for (int i = 1; i < n; ++i) {
    if (s[i] == '?')
      ans *= 10;
    else if (s[i] >= 'A' && s[i] <= 'J') {
      if (!cc[s[i] - 'A']) countAlphabet++;
      cc[s[i] - 'A'] = 1;
    }
  }
  if (s[0] == '?') {
    ans *= 9;
    for (int i = 1; i <= countAlphabet; ++i) {
      ans *= 10 - i + 1;
    }
  } else if (!isdigit(s[0])) {
    if (!cc[s[0] - 'A']) countAlphabet++;
    for (int i = 1; i <= countAlphabet; ++i) {
      ans *= 10 - i + 1;
    }
    ans /= 10;
    ans *= 9;
  } else {
    for (int i = 1; i <= countAlphabet; ++i) {
      ans *= 10 - i + 1;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
