#include <bits/stdc++.h>
using namespace std;
char m[6], c[6], w[6], e[6], r[600];
int i, j, a, b, k, l, p, q, ck;
int vert() {
  for (q = 0; q < p; q++) {
    if (w[0] == r[0 + (6 * q)] && w[1] == r[1 + (6 * q)] &&
        w[2] == r[2 + (6 * q)] && w[3] == r[3 + (6 * q)] &&
        w[4] == r[4 + (6 * q)] && w[5] == r[5 + (6 * q)])
      ck = 0;
    if (w[0] == r[0 + (6 * q)] && w[5] == r[1 + (6 * q)] &&
        w[1] == r[2 + (6 * q)] && w[3] == r[3 + (6 * q)] &&
        w[2] == r[4 + (6 * q)] && w[4] == r[5 + (6 * q)])
      ck = 0;
    if (w[0] == r[0 + (6 * q)] && w[4] == r[1 + (6 * q)] &&
        w[5] == r[2 + (6 * q)] && w[3] == r[3 + (6 * q)] &&
        w[1] == r[4 + (6 * q)] && w[2] == r[5 + (6 * q)])
      ck = 0;
    if (w[0] == r[0 + (6 * q)] && w[2] == r[1 + (6 * q)] &&
        w[4] == r[2 + (6 * q)] && w[3] == r[3 + (6 * q)] &&
        w[5] == r[4 + (6 * q)] && w[1] == r[5 + (6 * q)])
      ck = 0;
  }
  return 0;
}
int check() {
  c[0] = m[i];
  c[1] = m[j];
  c[2] = m[a];
  c[3] = m[b];
  c[4] = m[k];
  c[5] = m[l];
  if (p == 0) {
    p++;
    r[0] = c[0];
    r[1] = c[1];
    r[2] = c[2];
    r[3] = c[3];
    r[4] = c[4];
    r[5] = c[5];
  } else {
    ck = 1;
    w[0] = c[0];
    w[1] = c[1];
    w[2] = c[2];
    w[3] = c[3];
    w[4] = c[4];
    w[5] = c[5];
    vert();
    w[0] = c[1];
    w[1] = c[2];
    w[2] = c[0];
    w[3] = c[4];
    w[4] = c[5];
    w[5] = c[3];
    vert();
    w[0] = c[2];
    w[1] = c[4];
    w[3] = c[5];
    w[4] = c[1];
    vert();
    w[0] = c[4];
    w[1] = c[5];
    w[3] = c[1];
    w[4] = c[2];
    vert();
    w[0] = c[5];
    w[1] = c[1];
    w[3] = c[2];
    w[4] = c[4];
    vert();
    w[0] = c[3];
    w[1] = c[1];
    w[2] = c[5];
    w[3] = c[0];
    w[4] = c[4];
    w[5] = c[2];
    vert();
    if (ck == 1) {
      r[0 + (6 * p)] = c[0];
      r[1 + (6 * p)] = c[1];
      r[2 + (6 * p)] = c[2];
      r[3 + (6 * p)] = c[3];
      r[4 + (6 * p)] = c[4];
      r[5 + (6 * p)] = c[5];
      p++;
    }
  }
  return 0;
}
int main() {
  cin >> m[0] >> m[1] >> m[2] >> m[3] >> m[4] >> m[5];
  for (i = 0; i < 6; i++)
    for (j = 0; j < 6; j++)
      if (j != i)
        for (a = 0; a < 6; a++)
          if (a != i && a != j)
            for (b = 0; b < 6; b++)
              if (b != i && b != j && b != a)
                for (k = 0; k < 6; k++)
                  if (k != i && k != j && k != a && k != b)
                    for (l = 0; l < 6; l++)
                      if (l != i && l != j && l != a && l != b && l != k)
                        check();
  cout << p;
  return 0;
}
