#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-12;
const int INF = 999999999;
const int r1[] = {0, 2, 3, 4, 1, 5};
const int r2[] = {1, 5, 2, 0, 4, 3};
const int r3[] = {2, 1, 5, 3, 0, 4};
string a, b;
char c[128];
int res;
bool Check() {
  string p = b, q = b;
  for (int k = 0; k < 4; ++k) {
    for (int i = 0; i < 6; ++i) q[i] = p[r1[i]];
    if (q < b) return 0;
    p = q;
  }
  for (int j = 0; j < 4; ++j) {
    for (int i = 0; i < 6; ++i) q[i] = p[r2[i]];
    p = q;
    for (int k = 0; k < 4; ++k) {
      for (int i = 0; i < 6; ++i) q[i] = p[r1[i]];
      if (q < b) return 0;
      p = q;
    }
  }
  for (int j = 0; j < 4; ++j) {
    for (int i = 0; i < 6; ++i) q[i] = p[r3[i]];
    p = q;
    for (int k = 0; k < 4; ++k) {
      for (int i = 0; i < 6; ++i) q[i] = p[r1[i]];
      if (q < b) return 0;
      p = q;
    }
  }
  return 1;
}
void Go(int t) {
  if (t == 6) {
    if (Check()) {
      ++res;
    }
    return;
  }
  for (int i = 0; i < int((a).size()); ++i)
    if (c[a[i]] > 0) {
      --c[a[i]];
      b[t] = a[i];
      Go(t + 1);
      ++c[a[i]];
    }
}
int main() {
  {
    char buf[7];
    scanf("%s", buf);
    a = buf;
  }
  memset(c, 0, sizeof(c));
  for (int i = 0; i < 6; ++i) ++c[a[i]];
  sort(a.begin(), a.end());
  a.resize(unique(a.begin(), a.end()) - a.begin());
  res = 0;
  b.resize(6);
  Go(0);
  printf("%d\n", res);
  return 0;
}
