#include <bits/stdc++.h>
using namespace std;
bool comp1(int& a, int& b);
int64_t gcd(int64_t a, int64_t b);
bool comp2(int& a, int& b);
bool comp3(pair<int, int>& a, pair<int, int>& b);
bool comp4(pair<int, int>& a, pair<int, int>& b);
bool isPrime(int& x);
void input(vector<int>& v, int& n) {
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
}
int sum(vector<int>& v) {
  int s = 0;
  for (auto& el : v) {
    s += el;
  }
  return s;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int64_t ans = 1;
  set<char> simbols;
  int cntQ = 0;
  ;
  for (size_t i = 0; i < s.size(); ++i) {
    if (s[i] == '?') {
      cntQ++;
    } else if (s[i] >= 'A' && s[i] <= 'J') {
      simbols.insert(s[i]);
    }
  }
  int k = 10;
  int size = simbols.size();
  if (s[0] == '?') {
    ans = 9;
    cntQ--;
  } else if (s[0] >= 'A' && s[0] <= 'J') {
    size--;
    k--;
    ans = 9;
  }
  for (int i = 0; i < size; ++i) {
    ans *= k;
    k--;
  }
  string g;
  while (ans > 0) {
    g += (ans % 10 + '0');
    ans /= 10;
  }
  reverse(g.begin(), g.end());
  for (int i = 0; i < cntQ; ++i) {
    g += '0';
  }
  cout << g;
  return 0;
}
