#include <bits/stdc++.h>
using namespace std;
vector<int> obrot_pion(vector<int> a) {
  vector<int> res(6);
  for (int i = 0; i < 6; i++) {
    if (i >= 4)
      res[i] = a[i];
    else {
      int pop = i - 1;
      if (pop < 0) pop += 4;
      res[i] = a[pop];
    }
  }
  return res;
}
int w(int val, vector<int> a) {
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == val) return i;
  }
  return -1;
}
vector<int> obrot_poziom(vector<int> a) {
  vector<int> pos = {0, 5, 2, 4};
  vector<int> res(6);
  for (int i = 0; i < 6; i++) {
    if (w(i, pos) == -1)
      res[i] = a[i];
    else {
      int pop = w(i, pos) - 1;
      if (pop < 0) pop += 4;
      res[i] = a[pos[pop]];
    }
  }
  return res;
}
set<vector<int> > s;
void solve(vector<int> a) {
  vector<vector<int> > ans;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      ans.push_back(a);
      a = obrot_poziom(a);
    }
    a = obrot_pion(a);
  }
  a = obrot_poziom(a);
  a = obrot_pion(a);
  for (int i = 0; i < 4; i++) {
    ans.push_back(a);
    a = obrot_poziom(a);
  }
  for (int i = 0; i < 3; i++) {
    a = obrot_pion(a);
  }
  for (int i = 0; i < 3; i++) {
    a = obrot_poziom(a);
  }
  for (int i = 0; i < 3; i++) {
    a = obrot_poziom(a);
  }
  a = obrot_pion(a);
  for (int i = 0; i < 4; i++) {
    ans.push_back(a);
    a = obrot_poziom(a);
  }
  for (int i = 0; i < 3; i++) {
    a = obrot_pion(a);
  }
  a = obrot_poziom(a);
  sort(ans.begin(), ans.end());
  s.insert(ans[0]);
}
int main() {
  vector<int> q;
  for (int i = 0; i < 6; i++) {
    char x;
    cin >> x;
    q.push_back(x);
  }
  sort(q.begin(), q.end());
  do {
    solve(q);
  } while (next_permutation(q.begin(), q.end()));
  cout << s.size() << endl;
  return 0;
}
