#include <bits/stdc++.h>
using namespace std;
long long count10 = 0;
long long ans = 1, x = 10;
string s;
int main() {
  map<char, bool> letter;
  letter['A'] = false, letter['B'] = false, letter['C'] = false;
  letter['D'] = false, letter['E'] = false, letter['F'] = false;
  letter['H'] = false, letter['I'] = false, letter['J'] = false;
  letter['G'] = false;
  cin >> s;
  if (s[0] == 'A' || s[0] == 'B' || s[0] == 'C' || s[0] == 'D' || s[0] == 'E' ||
      s[0] == 'F' || s[0] == 'G' || s[0] == 'H' || s[0] == 'I' || s[0] == 'J') {
    letter[s[0]] = true;
    ans = 9;
    x = 9;
  }
  if (s[0] == '?') ans = 9;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == 'A' || s[i] == 'B' || s[i] == 'C' || s[i] == 'D' ||
        s[i] == 'E' || s[i] == 'F' || s[i] == 'G' || s[i] == 'H' ||
        s[i] == 'I' || s[i] == 'J')
      if (!letter[s[i]]) {
        letter[s[i]] = true;
        if (x == 10)
          ++count10;
        else
          ans *= x;
        --x;
      }
    if (s[i] == '?') ++count10;
  }
  cout << ans;
  for (int i = 0; i < count10; ++i) cout << '0';
}
