#include <bits/stdc++.h>
using namespace std;
long long n, p, ans, cur, i;
bool c[505];
string s;
int main() {
  cin >> s;
  ans = 1;
  n = s.size();
  for (i = 0; i < n; i++)
    if (s[i] == '?') cur++;
  for (i = 0; i < n; i++)
    if (s[i] >= 'A' && s[i] <= 'Z' && !c[s[i]]) {
      c[s[i]] = 1;
      p++;
    }
  if (s[0] == '?') ans *= 9, cur--;
  for (i = 10; i >= 1 && p > 0; i--, p--) ans *= i;
  if (s[0] >= 'A' && s[0] <= 'Z') ans /= 10, ans *= 9;
  cout << ans;
  for (i = 1; i <= cur; i++) cout << 0;
  cout << endl;
}
