#include <bits/stdc++.h>
using namespace std;
string s;
int t[100];
int main() {
  cin >> s;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++)
    if (s[i] == '?')
      cnt++;
    else if (s[i] >= 'A' && s[i] <= 'J')
      t[s[i] - 'A']++;
  int ans = 0;
  for (int i = 0; i <= 30; i++)
    if (t[i]) {
      ans++;
    }
  if (ans > 10)
    cout << 0;
  else {
    long long int sol = 1;
    int ad = 10;
    if ((s[0] >= 'A' && s[0] <= 'J')) {
      sol *= 9;
      ad--;
      ans--;
    } else if (s[0] == '?') {
      sol *= 9;
      cnt--;
    }
    while (ans > 0) {
      sol *= ad;
      ad--;
      ans--;
    }
    cout << sol;
    for (int i = 1; i <= cnt; i++) cout << 0;
  }
  return 0;
}
