#include <bits/stdc++.h>
using namespace std;
map<char, int> aa;
int n, m, k, i, j, arr[1000000], ans, c, st;
string s, s2;
int main() {
  cin >> s;
  st = 0;
  ans = 1;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == '?') st++;
    if ((s[i] <= 'J') && (s[i] >= 'A')) {
      if (aa[s[i]] == 0) {
        c++;
        aa[s[i]] = 1;
      }
    }
  }
  for (i = 0; i < c; i++) ans *= 10 - i;
  if (s[0] == '?') {
    st--;
    ans *= 9;
  }
  if ((s[0] <= 'J') && (s[0] >= 'A')) {
    ans /= 10;
    ans *= 9;
  }
  cout << ans;
  for (i = 0; i < st; i++) cout << 0;
}
