#include <bits/stdc++.h>
using namespace std;
set<char> st;
int main() {
  string s;
  cin >> s;
  int ans = 1;
  int now = 10;
  if (s[0] >= 'A' && s[0] <= 'Z') {
    st.insert(s[0]);
    ans = 9;
    now = 9;
  } else if (s[0] == '?')
    ans = 9;
  else
    now = 10;
  int tt = 0;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == '?')
      tt++;
    else if (s[i] >= 'A' && s[i] <= 'Z') {
      if (st.find(s[i]) == st.end()) {
        ans *= now;
        now--;
        st.insert(s[i]);
      }
    }
  }
  cout << ans;
  for (int i = 1; i <= tt; i++) cout << 0;
  return 0;
}
