#include <bits/stdc++.h>
using namespace std;
int ans1 = 1, ans2 = 0, n, x[26], now;
char s[100100];
int main() {
  scanf("%s", s);
  n = strlen(s) - 1;
  for (int i = 0; i <= 25; ++i) x[i] = -1;
  for (int i = 0; i <= n; ++i) {
    if (s[i] == '?')
      if (i)
        ++ans2;
      else
        ans1 *= 9;
    if (s[i] >= 'A' && s[i] <= 'Z' && (x[s[i] - 'A'] < 0)) x[s[i] - 'A'] = i;
  }
  sort(x, x + 26);
  now = 10;
  for (int i = 0; i <= 25; ++i)
    if (x[i] >= 0)
      if (x[i] == 0)
        ans1 *= 9, --now;
      else
        ans1 *= now, --now;
  printf("%d", ans1);
  for (int i = 1; i <= ans2; ++i) printf("0");
  puts("");
  return 0;
}
