#include <bits/stdc++.h>
using namespace std;
string s;
void init() {}
void input() { cin >> s; }
void solve() {
  long long res = 1;
  int use = 10;
  bool used[10];
  for (int i = (0); i < (10); i++) used[i] = false;
  int zero = 0;
  if (s[0] == '?') res *= 9;
  if ('A' <= s[0] && s[0] <= 'J') res *= 9, use--, used[s[0] - 'A'] = true;
  for (int i = (1); i < (((int)s.size())); i++) {
    if (s[i] == '?') zero++;
    if ('A' <= s[i] && s[i] <= 'J') {
      if (!used[s[i] - 'A']) {
        res *= use--;
        used[s[i] - 'A'] = true;
      }
    }
  }
  cout << res;
  for (int i = (0); i < (zero); i++) cout << '0';
  cout << endl;
}
int main() {
  init();
  input();
  solve();
  return 0;
}
