#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[10];
  int a[26];
  memset(a, 0, sizeof(a));
  cin >> s;
  for (int i = 0; s[i]; i++) {
    a[s[i] - 'A']++;
  }
  int b[7];
  memset(b, 0, sizeof(b));
  for (int i = 0; i < 26; i++) {
    b[a[i]]++;
  }
  int r = 30;
  if (b[2] > 0) {
    if (b[1] == 4) {
      r = 15;
    } else if (b[1] == 2) {
      r = 8;
    } else if (b[1] == 1) {
      r = 3;
    } else if (b[1] == 0) {
      if (b[2] == 3) {
        r = 6;
      } else {
        r = 1 + 1;
      }
    }
  } else if (b[1] == 6) {
    r = 30;
  } else if (b[1] == 3) {
    r = 4 + 1;
  } else if (b[1] == 2) {
    r = 2;
  } else if (b[1] == 1) {
    r = 1;
  } else if (b[3] == 2) {
    r = 2;
  } else {
    r = 1;
  }
  cout << r << endl;
  return 0;
}
