#include <bits/stdc++.h>
using namespace std;
int vis[30];
char s[100100];
int main() {
  while (cin >> s) {
    int ans = 1;
    int nzeros = 0;
    int len = strlen(s);
    memset(vis, 0, sizeof(vis));
    for (int i = 0; s[i]; ++i) {
      if (s[i] == '?') {
        if (i)
          ++nzeros;
        else
          ans *= 9;
      } else if (s[i] >= 'A' && s[i] <= 'J')
        ++vis[s[i] - 'A'];
    }
    int x = 10;
    for (int i = 0; i < 30; ++i) {
      if (vis[i]) {
        if (x == 10 && s[0] >= 'A' && s[0] <= 'J')
          ans *= 9;
        else
          ans *= x;
        --x;
      }
    }
    if (ans != 0) {
      printf("%d", ans);
      for (int i = 0; i < nzeros; ++i) printf("0");
      puts("");
    } else
      puts("0");
  }
}
