#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 7;
long long cnt, ans, sum, a;
string g;
set<char> st;
map<long long, long long> mp, pm;
void DNM() {
  cin >> g;
  ans = 1;
  if (g[0] == '?') ans *= 9;
  a = sum = 0;
  if (g[0] >= 'A' and g[0] <= 'J') mp[g[0]] = 1, sum = 1, ans *= 9;
  for (long long i = 1; i < g.size(); i++) {
    if (g[i] == '?')
      a++;
    else if (g[i] >= 'A' and g[i] <= 'J') {
      mp[g[i]]++;
      if (mp[g[i]] == 1) st.insert(g[i]);
    }
  }
  cnt = 10;
  cnt -= sum;
  for (auto i : st) {
    ans *= cnt;
    cnt--;
  }
  cout << ans;
  while (a--) cout << 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int Qu_l_uQ = 1;
  while (Qu_l_uQ--) DNM();
}
