#include <bits/stdc++.h>
using namespace std;
int main() {
  string str, s = "QWERTYUIOPASDFGHJKLZXCVBNM";
  cin >> str;
  set<char> m;
  long long result = 1;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '?') {
      if (i == 0) {
        result *= 9;
      } else
        result *= 10;
    } else if (s.find(str[i]) != string::npos) {
      if (i == 0) {
        result *= 9;
        m.insert(str[i]);
      } else {
        if (m.find(str[i]) == m.end()) {
          result *= (10 - m.size());
          m.insert(str[i]);
        }
      }
    }
  }
  cout << result << "\n";
  return 0;
}
