#include <bits/stdc++.h>
using namespace std;
const int INF = (0u - 1) / 2;
int QMark(string& s) {
  int ans = 0;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '?') ans++;
  return ans;
}
int LetterNum(string& s) {
  bool a[26];
  for (int i = 0; i < 26; i++) a[i] = false;
  for (int i = 0; i < s.length(); i++)
    if (s[i] >= 'A' && s[i] <= 'Z') a[s[i] - 'A'] = true;
  int ans = 0;
  for (int i = 0; i < 26; i++)
    if (a[i]) ans++;
  return ans;
}
int ans(int n, int first) {
  int ans = 1;
  if (first == 0) {
    for (int i = 10 - n + 1; i <= 10; i++) ans *= i;
    return ans;
  } else if (first == 1) {
    ans *= 9;
    for (int i = 10 - n + 1; i < 10; i++) ans *= i;
    return ans;
  } else {
    ans *= 9;
    for (int i = 10 - n + 1; i <= 10; i++) ans *= i;
    return ans;
  }
}
int main() {
  string s;
  while (cin >> s) {
    int qm = QMark(s);
    int ln = LetterNum(s);
    int first = 0;
    if (s[0] >= 'A' && s[0] <= 'Z') first = 1;
    if (s[0] == '?') {
      first = 2;
      qm--;
    }
    int ns = ans(ln, first);
    cout << ns;
    for (int i = 0; i < qm; i++) cout << 0;
    cout << endl;
  }
}
