#include <bits/stdc++.h>
using namespace std;
string S;
int num[100], type, zero = 0;
vector<int> ans;
bool nz = false;
void print(vector<int> a) {
  for (int i = a.size() - 1; i >= 0; i--) printf("%d", a[i]);
  while (zero--) printf("0");
}
vector<int> exchange(int x) {
  vector<int> res;
  do {
    res.push_back(x % 10);
    x = x / 10;
  } while (x);
  return res;
}
vector<int> mul(vector<int> u, vector<int> v) {
  vector<int> res;
  res.assign(u.size() + v.size(), 0);
  int cr = 0;
  for (int i = 0; i < v.size(); i++)
    for (int j = 0; j < u.size(); j++) {
      int tmp = v[i] * u[j] + res[i + j], t = 0;
      cr = tmp / 10;
      res[i + j] = tmp % 10;
      while (cr) {
        tmp = res[i + j + (++t)] + cr;
        cr = tmp / 10;
        res[i + j + t] = tmp % 10;
      }
    }
  while (res.size() > 1 && res[res.size() - 1] == 0) res.pop_back();
  return res;
}
int main() {
  cin >> S;
  ans.push_back(1);
  for (int i = 0; i < S.size(); i++)
    if (S[i] == '?') {
      if (i == 0)
        ans = mul(ans, exchange(9));
      else
        zero++;
    } else if (S[i] >= 'A' && S[i] <= 'J') {
      if (!num[S[i]]) type++;
      num[S[i]] = 1;
      if (i == 0) nz = true;
    }
  if (!type) {
    print(ans);
    return 0;
  }
  type--;
  if (!nz)
    zero++;
  else
    ans = mul(ans, exchange(9));
  for (int i = 9; i >= 10 - type; i--) ans = mul(ans, exchange(i));
  print(ans);
  return 0;
}
