#include <bits/stdc++.h>
using namespace std;
int p1[] = {2, 4, 0, 5, 1, 3}, p2[] = {3, 5, 0, 2, 1, 4},
    perm[] = {0, 1, 2, 3, 4, 5};
char c[6];
string t, m;
set<string> s;
void rot4() {
  for (int i = 0; i < 4; i++) {
    char temp;
    temp = t[2];
    for (int i = 0; i < 3; i++) t[i + 2] = t[i + 3];
    t[5] = temp;
    m = min(m, t);
  }
}
void turnOver() {
  swap(t[0], t[1]);
  swap(t[2], t[4]);
}
int main() {
  for (int i = 0; i < 6; i++) cin >> c[i];
  do {
    t = "";
    m = "";
    for (int i = 0; i < 6; i++) {
      t += c[perm[i]];
      m += c[perm[i]];
    }
    rot4();
    turnOver();
    rot4();
    t = "";
    for (int i = 0; i < 6; i++) t += c[perm[p1[i]]];
    rot4();
    turnOver();
    rot4();
    t = "";
    for (int i = 0; i < 6; i++) t += c[perm[p2[i]]];
    rot4();
    turnOver();
    rot4();
    s.insert(m);
  } while (next_permutation(perm, perm + 6));
  cout << s.size() << endl;
}
