#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long long LINF = (long long)(4e18);
const double EPS = 1e-11;
const int MOD = 1000000007;
const int movel[6] = {4, 2, 0, 3, 1, 5};
const int moveup[6] = {5, 3, 2, 0, 4, 1};
string s;
vector<vector<int> > v;
set<vector<int> > equ;
void init() { cin >> s; }
string mult(string s, vector<int> v2) {
  string res(s.size(), '0');
  for (int i = 0; i < (int)s.size(); i++) {
    res[v2[i]] = s[i];
  }
  return res;
}
void solve() {
  init();
  sort(s.begin(), s.end());
  int cnt = 0;
  do {
    for (int i = 0; i < (int)v.size(); i++) {
      if (mult(s, v[i]) == s) {
        cnt++;
      }
    }
  } while (next_permutation(s.begin(), s.end()));
  assert(cnt % v.size() == 0);
  printf("%d\n", cnt / v.size());
}
vector<int> mult(vector<int> v1, vector<int> v2) {
  vector<int> res(v1.size());
  for (int i = 0; i < (int)v1.size(); i++) {
    res[v2[i]] = v1[i];
  }
  return res;
}
void precalc() {
  v.push_back(vector<int>(movel, movel + 6));
  v.push_back(vector<int>(moveup, moveup + 6));
  equ = set<vector<int> >(v.begin(), v.end());
  for (int i = 0; i < (int)v.size(); i++) {
    for (int j = 0; j <= i; j++) {
      vector<int> p1 = mult(v[i], v[j]);
      if (!equ.count(p1)) {
        equ.insert(p1);
        v.push_back(p1);
      }
      vector<int> p2 = mult(v[j], v[i]);
      if (!equ.count(p2)) {
        equ.insert(p2);
        v.push_back(p2);
      }
    }
  }
}
int main() {
  srand(88);
  precalc();
  solve();
  return 0;
}
