#include <bits/stdc++.h>
using namespace std;
char s[200000];
int main() {
  gets(s);
  int l = strlen(s);
  int o = 0;
  int a[100];
  memset(a, 0, sizeof(a));
  for (int i = 0; i < l; i++) {
    if (s[i] == '?') o++;
    if (s[i] >= 'A' && s[i] <= 'J') a[s[i] - 'A'] = 1;
  }
  int u = 0;
  for (int i = 0; i <= ('J' - 'A'); i++) u += a[i];
  long long ans = 1;
  for (int i = 0; i < u; i++) {
    if (i == 0 && (s[i] >= 'A' && s[i] <= 'J'))
      ans = ans * 9;
    else
      ans = ans * (10 - i);
  }
  if (s[0] == '?') {
    o--;
    ans = ans * 9;
  }
  cout << ans;
  for (int i = 0; i < o; i++) printf("0");
  cout << endl;
}
