#include <bits/stdc++.h>
using namespace std;
char s[110000];
char ch;
int top;
int flag[20][10];
int flag1[20];
int flag2[20];
int num, ans;
int fwen;
inline void init() {
  s[++top] = getchar();
  while (s[top] != '\n') s[++top] = getchar();
  top--;
  for (int i = 1; i <= top; ++i) {
    if (s[i] == '?') {
      if (i == 1)
        fwen = 1;
      else
        num++;
    }
    if (isalpha(s[i])) {
      if (!flag1[s[i] - 'A']) {
        for (int j = 0; j <= 9; ++j) flag[s[i] - 'A'][j] = 1;
        if (i == 1) flag[s[i] - 'A'][0] = 0;
      }
      flag1[s[i] - 'A'] = 1;
    }
  }
}
inline void work() {
  if (isalpha(s[1])) {
    int x = 0;
    for (int i = 0; i <= 9; ++i)
      if (flag1[i]) x++;
    if (x) ans = 9;
    for (int i = 1; i <= x - 1; ++i) ans *= (10 - i);
  } else {
    int x = 0;
    for (int i = 0; i <= 9; ++i)
      if (flag1[i]) x++;
    ans = 1;
    for (int i = 1; i <= x; ++i) ans *= (10 - i + 1);
  }
  if (fwen) ans *= 9;
  if (!ans) ans = 1;
  cout << ans;
  for (int i = 1; i <= num; ++i) cout << '0';
  cout << endl;
}
int main() {
  init();
  work();
  return 0;
}
