#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:300000000")
const long double eps = 1e-20;
const long double pi = acos(-1.0);
const long long inf = 1000 * 1000 * 1000 * 1000 * 1000 * 1000;
const long long base = 1000 * 1000 * 1000 + 7;
using namespace std;
string s;
set<char> all;
map<char, int> kol;
int cnt = 0;
int a[111];
void r(int x) {
  cout << x;
  exit(0);
}
int main() {
  cin >> s;
  for (int i = 0; i < (s.size()); i++) all.insert(s[i]);
  for (int i = 0; i < (s.size()); i++) kol[s[i]]++;
  for (set<char>::iterator it = all.begin(); it != all.end(); it++) {
    a[cnt++] = kol[*it];
  }
  sort(a, a + cnt);
  reverse(a, a + cnt);
  if (a[0] == 6) r(1);
  if (a[0] == 5) r(1);
  if (a[0] == 4) r(2);
  if (a[1] == 3) r(2);
  if (a[0] + a[1] == 5) r(3);
  if (a[0] == 3) r(5);
  if (a[2] == 2) r(6);
  if (a[1] == 2) r(8);
  if (a[0] == 2) r(15);
  r(30);
  return 0;
}
