#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
template <class T>
bool get_max(T& a, const T& b) {
  return b > a ? a = b, 1 : 0;
}
template <class T>
bool get_min(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
char s[100010];
int main() {
  while (scanf("%s", s) != EOF) {
    int rec[11];
    bool vis[11];
    long long ans = 1;
    int len = strlen(s);
    int zero = 0;
    int num = 10;
    for (int i = 0; i < 10; i++) rec[i] = 1;
    memset(vis, false, sizeof(vis));
    if (s[0] == '?') ans *= 9;
    if (s[0] >= 'A' && s[0] <= 'J') {
      rec[s[0] - 'A'] = 9;
      vis[s[0] - 'A'] = true;
      num--;
    }
    for (int i = 1; i < len; i++) {
      if (s[i] == '?')
        zero++;
      else if (s[i] >= 'A' && s[i] <= 'J' && vis[s[i] - 'A'] == false) {
        rec[s[i] - 'A'] = num--;
        vis[s[i] - 'A'] = true;
      }
    }
    for (int i = 0; i < 10; i++) {
      ans *= rec[i];
    }
    cout << ans;
    for (int i = 0; i < zero; i++) {
      printf("0");
    }
    printf("\n");
  }
  return 0;
}
