#include <bits/stdc++.h>
using namespace std;
int kk[7];
int main() {
  string s;
  cin >> s;
  int n = s.length();
  sort(s.begin(), s.end());
  for (int i = 0, j; i < n; i = j) {
    j = i + 1;
    while (j < n && s[j] == s[i]) j++;
    kk[j - i]++;
  }
  int ans;
  if (kk[6] == 1 || kk[5] == 1 && kk[1] == 1)
    ans = 1;
  else if (kk[4] == 1 || kk[3] == 2)
    ans = 2;
  else if (kk[3] == 1 && kk[2] == 1 && kk[1] == 1)
    ans = 3;
  else if (kk[3] == 1 && kk[1] == 3)
    ans = 5;
  else if (kk[2] == 3)
    ans = 6;
  else if (kk[2] == 2 && kk[1] == 2)
    ans = 8;
  else if (kk[2] == 1 && kk[1] == 4)
    ans = 15;
  else
    ans = 30;
  cout << ans << '\n';
  return 0;
}
