#include <bits/stdc++.h>
using namespace std;
bool seen[256];
long long choose(long long a, long long b) {
  long long ans = 1;
  for (long long x = a; x > a - b; x--) {
    ans = ans * x;
  }
  return ans;
}
int main() {
  string S;
  cin >> S;
  int N = S.length();
  int num_letters = 0;
  int num_questions = 0;
  for (int i = 0; i < (N); ++i) {
    if (S[i] == '?')
      num_questions++;
    else if (isupper(S[i]) && !seen[S[i]]) {
      seen[S[i]] = true;
      num_letters++;
    }
  }
  long long ans = 0;
  if (isupper(S[0])) {
    ans = 9 * choose(9, num_letters - 1);
  } else if (S[0] == '?') {
    num_questions--;
    ans = 9 * choose(10, num_letters);
  } else {
    ans = choose(10, num_letters);
  }
  cout << ans;
  for (int i = 0; i < (num_questions); ++i) cout << '0';
  cout << endl;
}
