#include <bits/stdc++.h>
using namespace std;
template <typename T>
string tostr(const T& t) {
  ostringstream os;
  os << t;
  return os.str();
}
string rotate(string A, int dir) {
  string B = A;
  switch (dir) {
    case 0: {
      B[0] = A[4];
      B[4] = A[1];
      B[1] = A[5];
      B[5] = A[0];
      break;
    }
    case 2: {
      B[2] = A[4];
      B[4] = A[3];
      B[3] = A[5];
      B[5] = A[2];
      break;
    }
    case 6: {
      B[0] = A[3];
      B[3] = A[1];
      B[1] = A[2];
      B[2] = A[0];
      break;
    }
  }
  return B;
}
int main(int argc, char* argv[]) {
  int res = 0;
  string s;
  cin >> s;
  sort((s).begin(), (s).end());
  do {
    bool ok = true;
    string t = s;
    for (int i = 0; i < 4; ++i) {
      for (int j = 0; j < 4; ++j) {
        for (int k = 0; k < 4; ++k) {
          if (t < s) ok = false;
          t = rotate(t, 6);
        }
        t = rotate(t, 2);
      }
      t = rotate(t, 0);
    }
    if (ok) res++;
  } while (next_permutation((s).begin(), (s).end()));
  printf("%d\n", res);
  return 0;
}
