#include <bits/stdc++.h>
using namespace std;
string ss;
int ans = 1, kol, kolnol;
bool was[1111], can[11];
char s[111111];
int main() {
  getline(cin, ss);
  int len = ss.length();
  ss += 'b';
  for (int i = 0; i < len; i++)
    if (ss[i] != ss[i + 1] || ss[i] == '?') {
      kol++;
      s[kol] = ss[i];
    }
  len = kol;
  if (len == 1) {
    if (s[1] >= 48 && s[1] <= 57)
      cout << 1 << endl;
    else
      cout << 9 << endl;
    return 0;
  }
  for (int i = 1; i <= len; i++) {
    if (s[i] == '?') {
      if (i == 1)
        ans *= 9;
      else {
        kolnol++;
      }
    } else if (s[i] >= 65 && s[i] <= 90) {
      if (!was[s[i]]) {
        was[s[i]] = true;
        for (int j = 10; j >= 1; j--)
          if (!can[j]) {
            can[j] = true;
            ans *= j;
            break;
          }
      }
    }
  }
  if (s[1] >= 65 && s[1] <= 90) {
    ans *= 9;
    ans /= 10;
  }
  cout << ans;
  for (int i = 1; i <= kolnol; i++) cout << 0;
  cout << endl;
  return 0;
}
