#include <bits/stdc++.h>
using namespace std;
char buf[16];
vector<char> C;
vector<string> W;
inline string canon(string s) {
  string res("0000");
  for (int i = 0; i < 4; ++i) res[i] = s[i + 1];
  for (int i = 1; i < 4; ++i) {
    string str("0000");
    for (int j = 0; j < 4; ++j) str[j] = s[1 + (j + i) % 4];
    if (str < res) res = str;
  }
  string c1("0"), c2("0");
  c1[0] = s[0];
  c2[0] = s[5];
  res = c1 + res + c2;
  return (res);
}
inline void add() {
  string res("000000");
  for (int i = 0; i < 6; ++i) res[i] = C[i];
  res = canon(res);
  vector<string> r;
  r.push_back(res);
  if (true) {
    string res2(res);
    res2[1] = res[5];
    res2[5] = res[3];
    res2[3] = res[0];
    res2[0] = res[1];
    r.push_back(canon(res2));
  }
  if (true) {
    string res2(res);
    res2[0] = res[2];
    res2[4] = res[0];
    res2[5] = res[4];
    res2[2] = res[5];
    r.push_back(canon(res2));
  }
  if (true) {
    string res2(res);
    res2[1] = res[0];
    res2[5] = res[1];
    res2[3] = res[5];
    res2[0] = res[3];
    r.push_back(canon(res2));
  }
  if (true) {
    string res2(res);
    res2[4] = res[5];
    res2[5] = res[2];
    res2[2] = res[0];
    res2[0] = res[4];
    r.push_back(canon(res2));
  }
  if (true) {
    string res2(res);
    res2[0] = res[5];
    res2[5] = res[0];
    res2[2] = res[4];
    res2[4] = res[2];
    r.push_back(canon(res2));
  }
  sort(r.begin(), r.end());
  W.push_back(r[0]);
}
int main() {
  scanf("%s", buf);
  for (int i = 0; i < 6; ++i) C.push_back(buf[i]);
  sort(C.begin(), C.end());
  int na = 1;
  for (int i = 1; i < 6; ++i)
    if (C[i] == C[0]) ++na;
  do {
    add();
  } while (next_permutation(C.begin() + 1, C.end()));
  sort(W.begin(), W.end());
  vector<string>::iterator ne = unique(W.begin(), W.end());
  printf("%d\n", (int)(ne - W.begin()));
  return (0);
}
