#include <bits/stdc++.h>
using namespace std;
void pan(int x, int y, int z) {
  if (x == 1 && y == 1 && z == 1)
    printf("30\n");
  else if (x == 2 && y == 1 && z == 1)
    printf("15\n");
  else if (x == 3 && y == 1 && z == 1)
    printf("5\n");
  else if (x == 4 && y == 1 && z == 1)
    printf("2\n");
  else if (x == 5 && y == 1)
    printf("1\n");
  else if (x == 6 && y == 0)
    printf("1\n");
  else if (x == 2 && y == 2 && z == 1)
    printf("8\n");
  else if (x == 2 && y == 2 && z == 2)
    printf("6\n");
  else if (x == 3 && y == 2)
    printf("3\n");
  else if (x == 4 && y == 2)
    printf("2\n");
  else if (x == 3 && y == 3)
    printf("2\n");
}
int main() {
  char c[8];
  int a[8];
  while (scanf("%s", c) != EOF) {
    memset(a, 0, sizeof(a));
    for (int i = 0; i < strlen(c); i++) {
      if (c[i] == 'R') {
        a[0]++;
      } else if (c[i] == 'O') {
        a[1]++;
      } else if (c[i] == 'Y') {
        a[2]++;
      } else if (c[i] == 'G') {
        a[3]++;
      } else if (c[i] == 'B') {
        a[4]++;
      } else if (c[i] == 'V') {
        a[5]++;
      }
    }
    sort(a, a + 6);
    pan(a[5], a[4], a[3]);
  }
  return 0;
}
