#include <bits/stdc++.h>
using namespace std;
int const maxn = (int)1e2 + 111;
int const inf = (1 << 30) - 1;
bool used[maxn];
string second;
int main() {
  cin >> second;
  long long res = 1;
  int cc = 0;
  for (int i = 0; i < second.length(); i++) {
    if ('A' <= second[i] && second[i] <= 'Z') {
      used[second[i] - 'A'] = true;
    } else if (second[i] == '?') {
      if (i == 0)
        res *= 9;
      else
        cc++;
    }
  }
  int cnt = 0;
  for (int i = 0; i < 26; i++) {
    if (used[i]) cnt++;
  }
  int q = 10;
  for (int i = 1; i <= cnt; i++) {
    if (i == 1 && 'A' <= second[0] && second[0] <= 'Z')
      res *= 9;
    else
      res *= q;
    q--;
  }
  cout << res;
  for (int i = 0; i < cc; i++) cout << 0;
  return 0;
}
