#include <bits/stdc++.h>
using namespace std;
char s[1000005];
int c = 1, now = 10, used[128] = {}, nz = 0;
int main(void) {
  scanf("%s", s);
  for (int i = 0; s[i]; i++)
    if (s[i] >= 'A' && s[i] <= 'J') {
      if (used[(int)s[i]]) continue;
      used[(int)s[i]] = 1;
      if (i == 0)
        c *= 9;
      else
        c *= now;
      now--;
    } else if (s[i] == '?') {
      if (i == 0)
        c *= 9;
      else
        nz++;
    }
  printf("%d", c);
  for (int i = 0; i < nz; i++) printf("0");
  puts("");
  return 0;
}
