#include <bits/stdc++.h>
using namespace std;
bool a[100] = {0};
int main() {
  string s;
  cin >> s;
  int n = s.length(), i, qus = 0, cha = 0;
  long long ans = 1, cal;
  for (i = 0; i < n; i++)
    if (s[i] == '?')
      qus++;
    else if (s[i] >= 'A' && s[i] <= 'J' && a[s[i]] != 1) {
      cha++;
      a[s[i]] = 1;
    }
  if (cha != 0) {
    cal = 1;
    for (i = 0; i < cha; i++) cal *= 10 - i;
    ans *= cal;
  }
  if (s[0] >= 'A' && s[0] <= 'J') ans = ans / 10 * 9;
  if (s[0] == '?') {
    ans *= 9;
    qus--;
  }
  cout << ans;
  for (i = 0; i < qus; i++) cout << 0;
}
