#include <bits/stdc++.h>
using namespace std;
map<char, bool> m;
int zeros;
int cnt;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '?' && i) zeros++;
    if (s[i] >= 'A' && s[i] <= 'J') m[s[i]] = true;
  }
  for (char i = 'A'; i <= 'J'; i++)
    if (m[i]) cnt++;
  long long ans = 1;
  if (s[0] == '?') ans *= 9;
  if (s[0] >= 'A' && s[0] <= 'J' && cnt) {
    ans *= 9;
    cnt--;
    for (int i = 9; i >= 10 - cnt; i--) ans *= i;
  } else if (cnt) {
    for (int i = 10; i >= 11 - cnt; i--) ans *= i;
  }
  cout << ans;
  for (int i = 0; i < zeros; i++) cout << 0;
  return 0;
}
