#include <bits/stdc++.h>
using namespace std;
int main() {
  char ch;
  map<char, int> k;
  char t[6];
  char all[1000][6];
  int p[] = {1, 2, 3, 4, 5, 6};
  for (int x = 0; x < 6; x++) {
    cin >> ch;
    t[x] = ch;
    all[0][x] = ch;
    if (k.find(ch) == k.end())
      k[ch] = 1;
    else
      k[ch]++;
  }
  int i = 0;
  while (next_permutation(p, p + 6)) {
    for (int x = 0; x < 6; x++) all[i][x] = t[p[x] - 1];
    i++;
  }
  int co[24][6] = {
      1, 2, 3, 4, 5, 6, 3, 2, 5, 4, 6, 1, 6, 2, 1, 4, 3, 5, 1, 3, 4, 6, 5, 2,
      1, 6, 2, 3, 5, 4, 5, 2, 6, 4, 1, 3, 3, 5, 4, 1, 6, 2, 3, 1, 2, 5, 6, 4,
      6, 1, 4, 5, 3, 2, 6, 5, 2, 1, 3, 4, 4, 3, 5, 6, 2, 1, 2, 3, 1, 6, 4, 5,
      1, 4, 6, 2, 5, 3, 2, 6, 5, 3, 4, 1, 4, 6, 1, 3, 2, 5, 5, 6, 4, 3, 1, 2,
      5, 3, 2, 6, 1, 4, 4, 5, 6, 1, 2, 3, 2, 5, 3, 1, 4, 6, 3, 4, 1, 2, 6, 5,
      2, 1, 6, 5, 4, 3, 4, 1, 3, 5, 2, 6, 6, 4, 5, 2, 3, 1, 5, 4, 3, 2, 1, 6};
  bool good[1000] = {
      0,
  };
  for (int x = 0; x < i; x++)
    if (!good[x])
      for (int y = x + 1; y < i; y++) {
        for (int u = 0; u < 24; u++) {
          for (int z = 0; z < 6; z++) {
            if (all[x][z] != all[y][co[u][z] - 1]) break;
            if (z == 5) good[y] = 1;
          }
          if (good[y]) break;
        }
      }
  int rrr = 0;
  for (int x = 0; x < i; x++)
    if (!good[x]) rrr++;
  cout << rrr;
  return 0;
}
