#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, m;
char ss[maxn];
map<char, int> mp;
int main() {
  scanf("%s", ss + 1);
  string tt;
  int len = strlen(ss + 1);
  long long ans = 1, k = 10;
  if (ss[1] >= 'A' && ss[1] <= 'J') {
    ans = k = 9;
  } else if (ss[1] == '?')
    ans = 9;
  mp[ss[1]] = 1;
  for (int i = 2; i <= len; i++) {
    if (ss[i] == '?')
      tt += '0';
    else if (!mp[ss[i]] && ss[i] >= 'A' && ss[i] <= 'J')
      ans *= k, k--, mp[ss[i]] = 1;
  }
  cout << ans << tt << endl;
  return 0;
}
