#include <bits/stdc++.h>
using namespace std;
string s;
int m, n;
int a[99];
int main() {
  cin >> s;
  for (int i = 0; i < 99; i++) a[i] = 0;
  long long ans = 1;
  int cur = 10;
  if (s[0] == '?') ans *= 9;
  if ('A' <= s[0] && s[0] <= 'J') {
    ans *= 9;
    a[s[0] - 'A'] = 1;
    cur = 9;
  }
  long tt = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == '?') tt++;
    if ('A' <= s[i] && s[i] <= 'J' && a[s[i] - 'A'] == 0) {
      if (cur != 0) ans *= cur;
      cur--;
      a[s[i] - 'A'] = 1;
    }
  }
  cout << ans;
  for (int i = 0; i < tt; i++) cout << 0;
}
