#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
  char a[10] = {1};
  int b[7] = {1}, i, k = 0;
  cin >> a;
  sort(a, a + 6);
  for (i = 0; i < 5; ++i) {
    if (a[i] == a[i + 1])
      b[k]++;
    else {
      ++k;
      b[k]++;
    }
  }
  sort(b, b + k + 1, cmp);
  if (b[0] == 6) {
    cout << 1;
  } else if (b[0] == 5 && b[1] == 1) {
    cout << 1;
  } else if (4 == b[0] && 2 == b[1]) {
    cout << 2;
  } else if (3 == b[0] && 3 == b[1]) {
    cout << 2;
  } else if (2 == b[0] && 2 == b[1] && 2 == b[2]) {
    cout << 6;
  } else if (3 == b[0] && 2 == b[1] && 1 == b[2]) {
    cout << 3;
  } else if (4 == b[0] && 1 == b[1] && 1 == b[1]) {
    cout << 2;
  } else if (3 == b[0] && 1 == b[1] && 1 == b[2] && 1 == b[3]) {
    cout << 5;
  } else if (2 == b[0] && 2 == b[1] && 1 == b[2] && 1 == b[3]) {
    cout << 8;
  } else if (2 == b[0] && 1 == b[1] && 1 == b[2] && 1 == b[3] && 1 == b[4]) {
    cout << 15;
  } else
    cout << 30;
  cout << endl;
}
