#include <bits/stdc++.h>
using namespace std;
bool q;
struct cb {
  pair<char, char> d, h, v;
  bool q;
  vector<pair<char, char> > S, C;
  bool operator==(const cb &b) const {
    if (S != b.S) return 0;
    if (b.q || q) return 1;
    int c = 0;
    if (C[0] != b.C[0]) c++;
    if (C[1] != b.C[1]) c++;
    if (C[2] != b.C[2]) c++;
    c = max(0, c - 1);
    if (d != b.d && d != b.h && d != b.v) c++;
    if (v != b.d && v != b.h && v != b.v) c++;
    if (h != b.d && h != b.h && h != b.v) c++;
    return !(c & 1);
  }
};
int main() {
  string x;
  cin >> x;
  sort(x.begin(), x.end());
  set<char> fq;
  for (char h : x) fq.insert(h);
  vector<cb> RES;
  do {
    cb t;
    t.d = {x[0], x[1]};
    t.h = {x[2], x[3]};
    t.v = {x[4], x[5]};
    t.q = 0;
    if (x[0] == x[1] || x[2] == x[3] || x[4] == x[5]) t.q = 1;
    vector<pair<char, char> > G = {t.d, t.v, t.h};
    for (auto &h : G)
      if (h.first > h.second) swap(h.first, h.second);
    t.C = G;
    sort(G.begin(), G.end());
    t.S = G;
    if (t.S[0] == t.S[1] || t.S[1] == t.S[2] || t.S[0] == t.S[2]) t.q = 1;
    bool ad = 1;
    for (auto &h : RES) {
      if (h == t) {
        ad = 0;
        break;
      }
    }
    if (ad) RES.push_back(t);
  } while (next_permutation(x.begin(), x.end()));
  cout << RES.size() << endl;
}
