#include <bits/stdc++.h>
using namespace std;
int a[20];
int main() {
  string s;
  cin >> s;
  long long int r = 1;
  int counter = 10;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '?') {
      if (i == 0) {
        r *= 9;
      } else {
        r *= 10;
      }
    } else if (s[i] <= 'J' and s[i] >= 'A') {
      if (a[s[i] - 64] == 0 and i == 0) {
        r *= (counter - 1);
        --counter;
        a[s[i] - 64] = 1;
      } else if (a[s[i] - 64] == 0 and i != 0) {
        r *= (counter);
        --counter;
        a[s[i] - 64] = 1;
      }
    }
  }
  cout << r << endl;
  return 0;
}
