#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[10];
  scanf("%s", s);
  int f[30];
  for (int i = 0; i < 27; i++) f[i] = 0;
  for (int i = 0; i < 6; i++) {
    f[s[i] - 'A']++;
  }
  sort(f, f + 27);
  int ans = 0;
  if (f[26] == 6 || f[26] == 5)
    ans = 1;
  else if (f[26] == 4 || (f[26] == 3 && f[25] == 3))
    ans = 2;
  else if (f[26] == 3 && f[25] == 2)
    ans = 3;
  else if (f[26] == 3 && f[25] == 1)
    ans = 5;
  else if (f[26] == 2 && f[25] == 2 && f[24] == 2)
    ans = 6;
  else if (f[26] == 2 && f[25] == 2 && f[24] == 1)
    ans = 8;
  else if (f[26] == 2 && f[25] == 1)
    ans = 15;
  else if (f[26] == 1)
    ans = 30;
  printf("%d\n", ans);
  return 0;
}
