#include <bits/stdc++.h>
using namespace std;
int f[12] = {0};
int main() {
  string s;
  cin >> s;
  int q = 0;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '?')
      q++;
    else if (s[i] >= 'A' && s[i] <= 'J')
      f[s[i] - 'A']++;
  long long ans = 1;
  int start = 10;
  if (s[0] == '?') q--, ans = 9;
  if (s[0] >= 'A' && s[0] <= 'J') f[s[0] - 'A'] = 0, ans = 9, start = 9;
  for (int i = 0; i < 11; i++)
    if (f[i] > 0) ans *= start--;
  cout << ans;
  for (int i = 0; i < q; i++) printf("0");
  printf("\n");
  return 0;
}
