#include <bits/stdc++.h>
using namespace std;
int cmp(const void *a, const void *b) { return *(char *)a - *(char *)b; }
int cmp2(const void *a, const void *b) { return *(int *)b - *(int *)a; }
int main() {
  char a[7];
  int b[7];
  int c[15] = {0, 1, 1, 2, 2, 2, 3, 5, 6, 8, 15, 30};
  while (~scanf("%s", a)) {
    memset(b, 0, sizeof(b));
    qsort(a, 6, sizeof(a[0]), cmp);
    int count = 1;
    b[0] = 1;
    for (int i = 1; i < 6; i++)
      if (a[i] != a[i - 1])
        b[i] = 1;
      else {
        b[i] = b[i - 1] + 1;
        b[i - 1] = 0;
      }
    qsort(b, 6, sizeof(b[0]), cmp2);
    if (b[0] == 6 && b[1] == 0) count = 1;
    if (b[0] == 5 && b[1] == 1) count = 2;
    if (b[0] == 4 && b[1] == 2) count = 3;
    if (b[0] == 4 && b[1] == 1 && b[2] == 1) count = 4;
    if (b[0] == 3 && b[1] == 3) count = 5;
    if (b[0] == 3 && b[1] == 2 && b[2] == 1) count = 6;
    if (b[0] == 3 && b[1] == 1 && b[2] == 1 && b[3] == 1) count = 7;
    if (b[0] == 2 && b[1] == 2 && b[2] == 2) count = 8;
    if (b[0] == 2 && b[1] == 2 && b[2] == 1 && b[3] == 1) count = 9;
    if (b[0] == 2 && b[1] == 1 && b[2] == 1 && b[3] == 1 && b[4] == 1)
      count = 10;
    if (b[0] == 1 && b[1] == 1 && b[2] == 1 && b[3] == 1 && b[4] == 1 &&
        b[5] == 1)
      count = 11;
    printf("%d\n", c[count]);
  }
}
