#include <bits/stdc++.h>
using namespace std;
template <class T>
T inline Abs(const T& x) {
  return x < 0 ? -x : x;
}
template <class T>
T inline Sqr(const T& x) {
  return x * x;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  set<char> used;
  long long ans = 1;
  if (isalpha(s[0])) {
    used.insert(s[0]);
    ans *= 9;
  } else if (s[0] == '?') {
    ans *= 9;
  }
  int cnt = 0;
  for (int i = 1; i < s.length(); ++i) {
    if (isalpha(s[i])) {
      if (used.count(s[i]) == 0) {
        ans *= 10 - used.size();
        used.insert(s[i]);
      }
    } else if (s[i] == '?') {
      ++cnt;
    }
  }
  if (used.size() > 10) {
    cout << 0 << endl;
    exit(0);
  } else {
    cout << ans;
    for (int i = 0; i < cnt; ++i) {
      cout << 0;
    }
    cout << endl;
  }
  return 0;
}
