#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return (a > b ? (gcd(b, a)) : (a == 0 ? b : (gcd(b % a, a))));
};
template <typename T>
inline T lcm(T a, T b) {
  return a * b / gcd(a, b);
};
template <typename T>
inline T sqr(T a) {
  return a * a;
};
template <typename T>
inline T gmax(T a, T b) {
  return (a > b ? a : b);
};
template <typename T>
inline T gmin(T a, T b) {
  return (a < b ? a : b);
};
inline double rad(int a) { return (double)a * 3.1415926535897931 / 180; }
inline double round(double x) {
  return (x - floor(x) >= 0.5 ? ceil(x) : floor(x));
}
pair<int, int> extended_euclid(pair<int, int> ss) {
  if (ss.second == 0) return make_pair(1, 0);
  pair<int, int> temp =
      extended_euclid(make_pair(ss.second, ss.first % ss.second));
  return make_pair(temp.second,
                   temp.first - temp.second * (ss.first / ss.second));
}
inline unsigned long long fast_mod_pow(unsigned long long base,
                                       unsigned long long exp,
                                       unsigned long long MOD) {
  if (base == 0) return 0;
  unsigned long long res = 1;
  unsigned long long ss = base;
  while (exp > 0) {
    if (exp & 1) {
      res *= ss;
      res %= MOD;
    }
    exp >>= 1;
    ss *= ss;
    ss %= MOD;
  }
  return res;
}
inline bool isprime(unsigned long long ss) {
  if (ss == 2) return true;
  if (ss < 2 || ss % 2 == 0) return false;
  int numt = 15;
  unsigned long long base[] = {2,  3,  5,  7,  11, 13, 17, 19, 23, 29,
                               31, 37, 41, 43, 47, 53, 59, 61, 67, 71};
  unsigned long long x = ss - 1;
  int m = 0;
  while (x % 2 == 0) {
    x >>= 1;
    m++;
  }
  for (int i = 0; i < numt; i++) {
    if (base[i] >= ss) break;
    unsigned long long temp = fast_mod_pow(base[i], x, ss);
    if (temp == 1 || temp == ss - 1) continue;
    for (int j = 0; j < m; j++) {
      temp *= temp;
      temp %= ss;
      if (temp == ss - 1) break;
    }
    if (temp != ss - 1) return false;
  }
  return true;
}
const int maxn = 0;
const int maxm = 0;
const double esp = 1e-9;
const int BASE = 0;
void fillchar() {}
char a[7];
int n = 6;
inline string minmove(string s) {
  s += s;
  string res = "ZZZZ";
  for (int i = 0; i < 4; i++)
    if (s.substr(i, 4) < res) res = s.substr(i, 4);
  return res;
}
void enter() {
  fillchar();
  scanf("%s", a + 1);
  sort(a + 1, a + 1 + 6);
}
inline string getd(int x, int b) {
  string t = "";
  t += a[x];
  t += a[b];
  return t;
}
inline string get(int x, int b, int c, int d) {
  string t = "";
  t += a[x];
  t += a[b];
  t += a[c];
  t += a[d];
  return t;
}
void solve() {
  set<string> ss;
  do {
    string s = "ZZZZZZ";
    string t = getd(1, 2);
    t += minmove(get(3, 4, 5, 6));
    if (t < s) s = t;
    t = getd(2, 1);
    t += minmove(get(6, 5, 4, 3));
    if (t < s) s = t;
    t = getd(3, 5);
    t += minmove(get(1, 6, 2, 4));
    if (t < s) s = t;
    t = getd(5, 3);
    t += minmove(get(1, 4, 2, 6));
    if (t < s) s = t;
    t = getd(4, 6);
    t += minmove(get(1, 3, 2, 5));
    if (t < s) s = t;
    t = getd(6, 4);
    t += minmove(get(1, 5, 2, 3));
    if (t < s) s = t;
    ss.insert(s);
  } while (next_permutation(a + 1, a + 7));
  cout << ss.size();
}
int main() {
  enter();
  solve();
  return 0;
}
