#include <bits/stdc++.h>
using namespace std;
int const facesCount = 4;
void rotateHoriz(string& colors) {
  reverse(colors.begin() + 1, colors.begin() + facesCount);
  reverse(colors.begin(), colors.begin() + facesCount);
}
void rotateLeft(string& colors) {
  char const left = colors[(int)colors.size() - 1];
  char const right = colors[(int)colors.size() - 2];
  colors[(int)colors.size() - 1] = colors[3];
  colors[(int)colors.size() - 2] = colors[1];
  colors[1] = left;
  colors[3] = right;
}
void rotateUp(string& colors) {
  char const up = colors[0];
  char const bottom = colors[2];
  colors[0] = colors[(int)colors.size() - 2];
  colors[2] = colors[(int)colors.size() - 1];
  colors[(int)colors.size() - 1] = up;
  colors[(int)colors.size() - 2] = bottom;
}
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  string line;
  cin >> line;
  set<string> states;
  int res = 0;
  sort(line.begin(), line.end());
  do {
    string next(line);
    bool exists = false;
    for (int horizRot = (0); horizRot < ((4)); ++horizRot) {
      for (int leftRot = (0); leftRot < ((4)); ++leftRot) {
        for (int rightRot = (0); rightRot < ((4)); ++rightRot) {
          if (states.count(next)) exists = true;
          rotateUp(next);
        }
        rotateLeft(next);
      }
      rotateHoriz(next);
    }
    states.insert(line);
    if (!exists) {
      ++res;
    }
  } while (next_permutation(line.begin(), line.end()));
  cout << res << endl;
  return 0;
}
