#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  bool qStart = false;
  bool aStart = false;
  int lnum = 0;
  int qnum = 0;
  bool letters[10];
  for (int i = 0; i < 10; i++) {
    letters[i] = false;
  }
  if (s[0] == '?') qStart = true;
  if (s[0] - 64 > 0) aStart = true;
  for (int i = 0; i < s.length(); i++) {
    if ((int)s[i] - 64 > 0)
      letters[(int)s[i] - 65] = true;
    else if (s[i] == '?')
      qnum++;
  }
  for (int i = 0; i < 10; i++)
    if (letters[i]) lnum++;
  int total = 1;
  if (qStart) {
    total *= 9;
    qnum--;
  }
  if (aStart) {
    total *= 9;
    lnum--;
    for (int i = lnum; i > 0; i--) total *= 10 - i;
  } else {
    for (int i = lnum; i > 0; i--) total *= 11 - i;
  }
  string result;
  stringstream ss;
  ss << total;
  result = ss.str();
  for (int i = qnum; i > 0; i--) result += "0";
  cout << result;
}
