#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000,100000000")
using namespace std;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
char s[100005];
long long used[105];
long long now = 10;
long long ans = 1;
int main(void) {
  gets(s);
  long long n = strlen(s);
  if (s[0] == '?') ans = 9;
  if (s[0] >= 'A' && s[0] <= 'J') {
    ans = 9;
    used[s[0] - 'A'] = 1;
    now--;
  }
  long long zero = 0;
  for (long long(i) = 0; (i) < (long long)(n - 1); (i)++) {
    char c = s[i + 1];
    if (c == '?') zero++;
  }
  for (long long(i) = 0; (i) < (long long)(n - 1); (i)++) {
    char c = s[i + 1];
    if (c >= 'A' && c <= 'J') {
      if (!used[c - 'A']) {
        ans *= now;
        now--;
      }
      used[c - 'A'] = 1;
    }
  }
  cout << ans;
  for (long long(i) = 0; (i) < (long long)(zero); (i)++) printf("0");
  cout << endl;
  return 0;
}
