#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l = s.length();
  long long mf = 1;
  int arr[10] = {0};
  int flag = 0;
  int count = 10;
  for (int i = 0; i < l; i++) {
    if (s[i] == '?') {
      if (i == 0) {
        mf = mf * 9;
      } else {
        mf = mf * 10;
      }
    } else if (s[i] <= '9') {
      continue;
    } else {
      if (arr[int(s[i] - 'A')] == 0) {
        if (i == 0) {
          mf = mf * 9;
          count = count - 1;
          arr[int(s[i] - 'A')] = 1;
        } else {
          mf = mf * count;
          count = count - 1;
          arr[int(s[i] - 'A')] = 1;
        }
      }
    }
  }
  cout << mf << endl;
  return 0;
}
