#include <bits/stdc++.h>
using namespace std;
int INP, AM, REACHEOF;
char BUF[(1 << 12) + 1], *inp = BUF;
const long double PI = acos((long double)-1.0);
char s[100111];
bool mark[333];
int main() {
  while (gets(s)) {
    long long res = 1;
    int l = strlen(s);
    memset(mark, false, sizeof mark);
    int found = 0;
    for (int i = 0; i < l; ++i) {
      if (s[i] == '?') {
        if (i == 0)
          res *= 9;
        else
          res *= 10;
      } else if (s[i] >= 'A' && s[i] <= 'J' && !mark[s[i]]) {
        mark[s[i]] = true;
        if (i == 0)
          res *= 9;
        else
          res *= 10 - found;
        ++found;
      }
    }
    cout << res << endl;
  }
  return 0;
}
