#include <bits/stdc++.h>
using namespace std;
set<string> q;
bool buscar(string s) {
  string a, b, t, aux, c, aux2, r = s;
  int i, j, k;
  if (q.find(s) != q.end()) return false;
  t = s;
  for (i = 0; i < 4; i++) {
    t[0] = s[1], t[1] = s[5], t[5] = s[3], t[3] = s[0];
    if (q.find(t) != q.end()) return false;
    a = aux = t;
    for (j = 0; j < 4; j++) {
      a[0] = t[2], a[2] = t[5], a[5] = t[4], a[4] = t[0];
      if (q.find(a) != q.end()) return false;
      b = aux2 = c = a;
      for (k = 0; k < 4; k++) {
        b[0] = a[2], b[2] = a[5], b[5] = a[4], b[4] = a[0];
        if (q.find(b) != q.end()) return false;
      }
      a = b = c;
      for (k = 0; k < 4; k++) {
        b[0] = a[1], b[1] = a[5], b[5] = a[3], b[3] = a[0];
        if (q.find(b) != q.end()) return false;
      }
      t = aux2;
    }
    s = aux;
  }
  q.insert(r);
  return true;
}
int main() {
  int i, j, k, n;
  string s;
  while (cin >> s) {
    sort(s.begin(), s.end());
    i = j = 0;
    do {
      i += buscar(s);
      j++;
    } while (next_permutation(s.begin(), s.end()));
    cout << q.size() << endl;
    q.clear();
  }
  return 0;
}
