#include <bits/stdc++.h>
using namespace std;
int ar[1000];
int main() {
  string s;
  cin >> s;
  int res = 1, a = 10, zcnt = 0;
  if (s[0] == '?' || s[0] >= 'A' && s[0] <= 'J') {
    res *= 9;
    if (s[0] != '?') a--;
    ar[s[0] - 'A'] = 1;
  }
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == '?') {
      zcnt++;
    }
    if (s[i] >= 'A' && s[i] <= 'J') {
      if (ar[s[i] - 'A'] == 0) {
        res *= a;
        a--;
        ar[s[i] - 'A'] = 1;
      }
    }
  }
  cout << res;
  for (int i = 0; i < (zcnt); i++) cout << "0";
  cout << endl;
  return 0;
}
