#include <bits/stdc++.h>
using namespace std;
set<string> visited_;
string rotate_left(string &str) {
  string ret = str;
  ret[0] = str[1];
  ret[1] = str[2];
  ret[2] = str[3];
  ret[3] = str[0];
  return ret;
}
string rotate_front(string &str) {
  string ret = str;
  ret[4] = str[1];
  ret[1] = str[5];
  ret[5] = str[3];
  ret[3] = str[4];
  return ret;
}
bool visited(string &str) {
  if (visited_.count(str) > 0) {
    return true;
  }
  visited_.insert(str);
  string t = rotate_left(str);
  if (visited_.count(t) == 0) {
    visited(t);
  }
  t = rotate_front(str);
  if (visited_.count(t) == 0) {
    visited(t);
  }
  return false;
}
bool solve() {
  string colors;
  if (!(cin >> colors)) {
    return false;
  }
  visited_.clear();
  int ans = 0;
  for (int i = 0; i < 6 * 6 * 6 * 6 * 6 * 6; ++i) {
    string cur = colors;
    set<int> was;
    int c = i;
    for (int j = 0; j < 6; ++j) {
      cur[j] = colors[c % 6];
      was.insert(c % 6);
      c /= 6;
    }
    if (was.size() != 6) {
      continue;
    }
    if (!visited(cur)) {
      ++ans;
    }
  }
  printf("%d\n", ans);
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  while (solve())
    ;
  return 0;
}
