#include <bits/stdc++.h>
using namespace std;
char str[10], p[999];
int k, a, b, c, d;
int solve() {
  if (k == 1) return 1;
  if (k == 6) return 30;
  if (k == 5) return 15;
  if (k == 2) {
    if (p[255] == 5) return 1;
    return 2;
  }
  if (k == 3) {
    if (p[253] == 1 && p[254] == 1) return 2;
    if (p[253] == 1 && p[254] == 2) return 3;
    return 6;
  }
  if (k == 4) {
    if (p[255] == 3) return 5;
    return 8;
  }
}
int main() {
  memset(p, 0, sizeof p);
  scanf("%s", str);
  int len = strlen(str);
  k = 0;
  for (int i = 0; i < len; i++)
    if (p[str[i]]++ == 0) k++;
  sort(p, p + 256);
  printf("%d\n", solve());
  return 0;
}
