#include <bits/stdc++.h>
using namespace std;
template <class TT>
TT abs(TT a) {
  if (a < 0) return -a;
  return a;
}
set<string> se;
bool ch(string a) {
  bool t = true;
  string b, c;
  set<string> s;
  c = b = a;
  s.insert(b);
  int i, j;
  for (i = 0; i < 4; i++) {
    c[0] = b[3];
    c[1] = b[2];
    c[2] = b[0];
    c[3] = b[1];
    b = c;
    s.insert(b);
  }
  b = c = a;
  for (j = 0; j < 3; j++) {
    c[0] = b[4];
    c[1] = b[5];
    c[4] = b[1];
    c[5] = b[0];
    b = c;
    s.insert(b);
  }
  b = c = a;
  for (j = 0; j < 3; j++) {
    c[2] = b[4];
    c[3] = b[5];
    c[4] = b[3];
    c[5] = b[2];
    b = c;
    s.insert(b);
  }
  for (__typeof(s.begin()) it = s.begin(); it != s.end(); ++it)
    if (se.find(*it) != se.end()) {
      t = false;
      break;
    }
  for (__typeof(s.begin()) it = s.begin(); it != s.end(); ++it) se.insert(*it);
  return t;
}
int main() {
  int i, j, k, l, n, m;
  string in;
  while (cin >> in) {
    sort((in).begin(), (in).end());
    se.clear();
    n = 0;
    do {
      if (ch(in)) n++;
    } while (next_permutation((in).begin(), (in).end()));
    cout << n << endl;
  }
  return 0;
}
