#include <bits/stdc++.h>
using namespace std;
map<char, int> mp;
int b[6];
char a;
int main() {
  for (register int i = (1); i <= (6); ++i) cin >> a, mp[a]++;
  b[0] = mp['Y'], b[1] = mp['B'], b[2] = mp['O'], b[3] = mp['R'],
  b[4] = mp['G'], b[5] = mp['V'];
  sort(b, b + 6);
  if (b[5] == 6) puts("1");
  if (b[5] == 5) puts("1");
  if (b[5] == 4) puts("2");
  if (b[5] == 1) puts("30");
  if (b[5] == 3 && b[4] == 3) puts("2");
  if (b[5] == 3 && b[4] == 2) puts("3");
  if (b[5] == 3 && b[4] == 1) puts("5");
  if (b[5] == 2 && b[4] == 1) puts("15");
  if (b[5] == 2 && b[3] == 2) puts("6");
  if (b[5] == 2 && b[4] == 2 && b[3] == 1) puts("8");
  return 0;
}
