#include <bits/stdc++.h>
using namespace std;
string s;
bool vis[26];
int main() {
  cin >> s;
  long long ans = 1;
  int cnt1 = 0;
  int cnt2 = 0;
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '?')
      cnt2++;
    else if (s[i] >= 'A' && s[i] <= 'Z') {
      if (vis[s[i] - 'A'] == 1)
        continue;
      else
        vis[s[i] - 'A'] = 1, cnt1++;
    }
  }
  if (cnt1)
    if (s[0] >= 'A' && s[0] <= 'Z')
      ans = 9;
    else
      ans = 10;
  for (int i = 9; i > 9 - cnt1 + 1; i--) ans *= i;
  if (cnt2)
    if (s[0] == '?')
      ans *= 9;
    else
      ans *= 10;
  for (int i = 1; i < cnt2; i++) ans *= 10;
  cout << ans << endl;
  return 0;
}
