#include <bits/stdc++.h>
using namespace std;
template <class T>
string toStr(const T &x) {
  stringstream s;
  s << x;
  return s.str();
}
template <class T>
int toInt(const T &x) {
  stringstream s;
  s << x;
  int r;
  s >> r;
  return r;
}
int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int v[26];
  memset(v, 0, sizeof v);
  int zeros = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == '?')
      zeros++;
    else if (isalpha(s[i]))
      v[s[i] - 'A'] = true;
  }
  int ans = 1;
  int init;
  if (isalpha(s[0]) && s[0] != '?') {
    ans *= 9;
    v[s[0] - 'A'] = false;
    init = 9;
  } else if (s[0] == '?') {
    ans *= 9;
    init = 10;
  } else
    init = 10;
  for (int i = 0; i < 26; ++i)
    if (v[i]) ans *= init--;
  cout << ans;
  for (int i = 0; i < zeros; ++i) cout << 0;
  return 0;
}
