#include <bits/stdc++.h>
using namespace std;
template <typename T>
void debug(T v, string delimiter = "\n") {
  for (__typeof(v.begin()) it = v.begin(), it_end = v.end(); it != it_end; it++)
    cout << *it << delimiter;
  cout << flush;
}
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
string ds = "SENW";
const double PI = 4.0 * atan(1.0);
string solve(string s) {
  if (s[0] == '0') return 0;
  long long ans = 1;
  if (s[0] == '?' || isalpha(s[0])) ans = 9;
  string zero = "";
  vector<int> used(30);
  int rem = 10;
  if (isalpha(s[0])) {
    used[s[0] - 'A'] = 1;
    rem--;
  }
  for (int i = 1; i < (int)(s.size()); i++) {
    if (s[i] == '?') {
      zero += "0";
    } else if (isalpha(s[i])) {
      if (used[s[i] - 'A'] == 0) {
        used[s[i] - 'A'] = 1;
        ans *= rem;
        rem--;
      }
    }
  }
  ostringstream out;
  out << ans;
  string ret = out.str();
  return ret + zero;
}
int main() {
  string s;
  while (cin >> s) {
    cout << solve(s) << endl;
  }
  return 0;
}
