#include <bits/stdc++.h>
int main() {
  long long n1 = 0, n2 = 0, n3 = 1, n4;
  char c1 = 0;
  std::string s1, s2;
  std::cin >> s1;
  std::set<char> se1;
  if (s1[0] == '?')
    n2 += 9;
  else if (isalpha(s1[0]))
    n2 += 9, se1.insert(s1[0]), c1 = s1[0];
  else
    n2 += 1;
  for (int i = 1; i < s1.size(); i++) {
    n1 += (s1[i] == '?');
    if (isalpha(s1[i])) se1.insert(s1[i]);
  }
  n4 = 10;
  if (c1) se1.erase(c1), n4--;
  for (int i = 0; i < se1.size(); i++) n3 *= n4 - i;
  n2 *= n3;
  s2 = std::to_string(n2);
  if (n1) s2.append(n1, '0');
  std::cout << s2;
}
