#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& O, pair<T1, T2> t) {
  return O << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream& operator<<(ostream& O, vector<T> t) {
  for (int _ = 0; _ < (int)t.size(); ++_) O << t[_] << " ";
  return O;
}
int main() {
  ios_base::sync_with_stdio(0);
  char s[100500];
  cin >> s;
  int m[11];
  memset(m, 0, sizeof(m));
  int c = 0;
  for (int i = 0; s[i]; ++i) {
    if (s[i] == '?') ++c;
    if (s[i] >= 0 && s[i] <= '9') continue;
    m[s[i] - 'A']++;
  }
  int res = 1;
  for (int i = 0; i < c; ++i) {
    if (i == 0 && s[0] == '?')
      res *= 9;
    else
      res *= 10;
  }
  c = 0;
  for (int i = 0; i < 10; ++i) {
    if (m[i]) ++c;
  }
  for (int i = 0; i < c; ++i) {
    if (i == 0 && s[0] >= 'A' && s[0] <= 'Z')
      res *= 9;
    else
      res *= 10 - i;
  }
  cout << res;
  return 0;
}
int cpp4cf_main() {
  freopen("A.cpp", "r", stdin);
  char s[99];
  bool f;
  while (true) {
    cin >> s;
    if (cin.eof()) break;
    if (strstr(s, "/*")) {
      cin >> s;
      if (strstr(s, "Test")) {
        cin >> s;
        if (strstr(s, "on")) {
          cout << "Output: ";
          cpp4cf_main();
          cout << "\nAnswer: ";
          f = false;
          while (true) {
            cin >> s;
            if (strstr(s, "*/")) break;
            if (strstr(s, "//")) {
              if (f)
                cout << endl;
              else
                f = true;
            } else
              cout << s << " ";
          }
          cout << "\n\n";
        }
      }
    }
  }
  return 0;
}
