#include <bits/stdc++.h>
using namespace std;
map<vector<int>, int> mp;
int ig[11][6] = {
    {6, 0, 0, 0, 0, 0}, {1, 5, 0, 0, 0, 0}, {2, 4, 0, 0, 0, 0},
    {1, 1, 4, 0, 0, 0}, {3, 3, 0, 0, 0, 0}, {1, 2, 3, 0, 0, 0},
    {1, 1, 1, 3, 0, 0}, {2, 2, 2, 0, 0, 0}, {1, 1, 2, 2, 0, 0},
    {1, 1, 1, 1, 2, 0}, {1, 1, 1, 1, 1, 1},
};
int ans[11] = {1, 1, 2, 2, 2, 3, 5, 6, 8, 15, 30};
int main() {
  map<vector<int>, int> mp;
  for (int i = 0; i < 11; i++) {
    vector<int> tmp(ig[i], ig[i] + 6);
    mp[tmp] = ans[i];
  }
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  vector<int> t;
  int mn = 0;
  int i = 0;
  while (i < 6) {
    int r = 0;
    while (i < 6 && s[mn] == s[i]) i++, r++;
    mn = i;
    t.push_back(r);
  }
  sort(t.begin(), t.end());
  while (t.size() != 6) t.push_back(0);
  cout << mp[t] << endl;
  return 0;
}
