#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j = 0, k, l, n, m, p = 1, t, f;
  string s;
  long long int a[30];
  memset(a, 0, sizeof(a));
  cin >> s;
  l = s.size();
  for (i = 0; i < l; i++) {
    if (s[i] >= 65 && s[i] <= 74)
      a[(int)s[i] - 65]++;
    else if (s[i] == '?') {
      if (i > 0)
        j++;
      else
        p *= 9;
    }
  }
  k = 10;
  f = 1;
  if (s[0] >= 65 && s[0] <= 74) {
    p *= 9;
    f = 0;
    k = 9;
  }
  for (i = 0; i < 26; i++) {
    if (a[i] > 0 && f == 0)
      f = 1;
    else if (a[i] > 0 && f == 1) {
      p *= k;
      k--;
    }
  }
  cout << p;
  for (i = 0; i < j; i++) cout << "0";
}
