#include <bits/stdc++.h>
using namespace std;
set<string> st;
int tab[6][6] = {{1, 5, 4, 6, 2, 3}, {3, 4, 5, 2, 6, 1}, {6, 1, 4, 3, 2, 5},
                 {5, 3, 4, 1, 2, 6}, {2, 1, 6, 3, 5, 4}, {4, 1, 5, 3, 6, 2}};
int L;
vector<int> vec[24];
vector<char> s;
bool check() {
  vector<string> tmp;
  for (int i = 0; i < L; i++) {
    string is = "HHHHHH";
    for (int j = 0; j < 6; j++) is[j] = s[vec[i][j] - 1];
    if (st.count(is) > 0) return false;
    tmp.push_back(is);
  }
  for (int i = 0; i < tmp.size(); i++) st.insert(tmp[i]);
  return true;
}
int main() {
  for (int i = 0; i < 6; i++) {
    for (int k = 1; k < 5; k++) {
      vec[L].push_back(tab[i][0]);
      for (int j = 0, p = k; j < 4; j++, p++)
        vec[L].push_back(tab[i][(p - 1) % 4 + 1]);
      vec[L].push_back(tab[i][5]);
      L++;
    }
  }
  string ts;
  cin >> ts;
  int ans = 0;
  for (int i = 0; i < 6; i++) s.push_back(ts[i]);
  sort(s.begin(), s.end());
  do {
    if (check()) ans++;
  } while (next_permutation(s.begin(), s.end()));
  cout << ans << endl;
  return 0;
}
