#include <bits/stdc++.h>
using namespace std;
int N, M, T;
char str[10], temp[10], t[10], ch;
set<string> s;
void take(char st[]) {
  s.insert(st);
  ch = st[0];
  for (int i = 0; i < 3; i++) st[i] = st[i + 1];
  st[3] = ch;
  s.insert(st);
  ch = st[0];
  for (int i = 0; i < 3; i++) st[i] = st[i + 1];
  st[3] = ch;
  s.insert(st);
  ch = st[0];
  for (int i = 0; i < 3; i++) st[i] = st[i + 1];
  st[3] = ch;
  s.insert(st);
}
int main() {
  int i, j, k;
  scanf("%s", str);
  sort(str, str + 6);
  int co = 0;
  bool chk = false;
  int t1, t2;
  do {
    chk = true;
    for (i = 0; i < 6; i++) t[i] = str[i];
    t1 = s.size();
    take(t);
    swap(t[1], t[3]);
    swap(t[4], t[5]);
    take(t);
    t[1] = str[5];
    t[3] = str[4];
    t[4] = str[1];
    t[5] = str[3];
    take(t);
    swap(t[1], t[3]);
    swap(t[4], t[5]);
    take(t);
    t[0] = str[3];
    t[1] = str[5];
    t[2] = str[1];
    t[3] = str[4];
    t[4] = str[0];
    t[5] = str[2];
    take(t);
    swap(t[1], t[3]);
    swap(t[4], t[5]);
    take(t);
    t2 = s.size();
    if (t1 != t2) co++;
  } while (next_permutation(str, str + 6));
  printf("%d\n", co);
  scanf(" ");
}
