#include <bits/stdc++.h>
using namespace std;
char s[100010];
int main() {
  scanf("%s", s);
  int cnt = 0;
  bool flag[200] = {};
  int n = strlen(s);
  for (int i = 0; i < n; ++i) {
    if (s[i] == '?')
      cnt++;
    else if (s[i] >= 'A')
      flag[s[i]] = 1;
  }
  int c2 = 0;
  for (char x = 'A'; x <= 'Z'; ++x)
    if (flag[x]) ++c2;
  int ans = 1;
  for (int i = 0; i < c2; ++i) ans = ans * (10 - i);
  if (s[0] == '?') ans = ans * 9, cnt--;
  if (s[0] >= 'A' && s[0] <= 'J') ans = ans / 10 * 9;
  printf("%d", ans);
  for (int i = 0; i < cnt; ++i) printf("0");
  printf("\n");
}
