#include <bits/stdc++.h>
using namespace std;
string s;
long long ans, t = 10, used[500], p;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  if (s[0] == '?')
    ans = 9;
  else if (s[0] >= 'A') {
    t--;
    used[s[0]] = 1;
    ans = 9;
  } else
    ans = 1;
  for (int i = 1; i < s.length(); i++)
    if (s[i] == '?')
      p++;
    else if (s[i] >= 'A' && !used[s[i]]) {
      ans *= t;
      t--;
      used[s[i]] = 1;
    }
  cout << ans;
  for (int i = 0; i < p; i++) cout << 0;
}
