#include <bits/stdc++.h>
using namespace std;
char a[10];
void left(char *b) {
  char t = b[0];
  b[0] = b[1];
  b[1] = b[2];
  b[2] = b[3];
  b[3] = t;
}
void front(char *b) {
  char t = b[4];
  b[4] = b[0];
  b[0] = b[5];
  b[5] = b[2];
  b[2] = t;
}
void side(char *b) {
  char t = b[4];
  b[4] = b[1];
  b[1] = b[5];
  b[5] = b[3];
  b[3] = t;
}
char ww[10];
map<long long, int> m;
long long enc(char *w) {
  int i;
  long long ret = 0;
  for (i = 0; i < 6; i++) ret = ret * 26 + w[i] - 'A' + 1;
  return ret;
}
int test(char *w) {
  int i, j, z;
  long long rv = 0, k;
  for (z = 0; z < 4; z++) {
    for (j = 0; j < 4; j++) {
      for (i = 0; i < 4; i++) {
        left(w);
        k = enc(w);
        if (k > rv) {
          rv = k;
        }
        if (m.count(k)) return 0;
      }
      front(w);
    }
    side(w);
  }
  m[rv] = 1;
  return 1;
}
int main(void) {
  scanf("%s", a);
  sort(a, a + 6);
  int cnt = 0;
  do {
    strcpy(ww, a);
    cnt += test(ww);
  } while (next_permutation(a, a + 6));
  printf("%d\n", cnt);
  return 0;
}
