#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:20000000")
string problem_name = "a";
void init() { freopen((problem_name + ".in").c_str(), "rt", stdin); }
long long res = 0;
int ms[300100];
int len;
void mul(int val) {
  int p = 0;
  for (int i = 0; i < 300000; i++) {
    p += ms[i] *= val;
    ms[i] = p % 10;
    p /= 10;
  }
}
int main() {
  string s;
  cin >> s;
  vector<int> u(255, 0);
  res = 1;
  int zero = 0;
  long long col = 10;
  int c = 0;
  int c2 = 0;
  for (int i = 0; i < int((s).size()); i++) {
    if (s[i] == '?') {
      c++;
    } else if (isalpha(s[i])) {
      if (u[s[i]]) continue;
      u[s[i]] = 1;
      if (col <= 0) {
        res = 0;
        zero = 1;
        break;
      }
      c2++;
      col--;
    }
  }
  if (zero) {
    cout << 0;
    return 0;
  }
  if (c) {
    if (s[0] == '?')
      ms[c - 1] = 9;
    else
      ms[c] = 1;
  } else
    ms[0] = 1;
  if (c2) {
    for (int i = 10; i > 10 - c2; i--) {
      if (i == 10 && isalpha(s[0]))
        mul(9);
      else
        mul(i);
    }
  }
  int len = 300000;
  while (!ms[len]) len--;
  for (int i = len; i >= 0; i--) printf("%d", ms[i]);
  return 0;
}
