#include <bits/stdc++.h>
using namespace std;
struct info {
  int l, r, u, d;
} d[10];
bool bo[7][7][7][7][7][7];
int a[7], b[7], c[1000];
int f[7][7] = {{0},
               {0, 1, 2, 3, 4, 5, 6},
               {0, 2, 3, 4, 1, 5, 6},
               {0, 3, 4, 1, 2, 5, 6},
               {0, 4, 1, 2, 3, 5, 6},
               {0, 5, 2, 6, 4, 3, 1},
               {0, 6, 2, 5, 4, 1, 3}};
char ss[10] = {"ROYGBV"}, s[10];
void solve(int a[7]) {
  bo[a[1]][a[2]][a[3]][a[4]][a[5]][a[6]] = true;
  bo[a[1]][a[4]][a[3]][a[2]][a[6]][a[5]] = true;
  bo[a[1]][a[5]][a[3]][a[6]][a[4]][a[2]] = true;
  bo[a[1]][a[6]][a[3]][a[5]][a[2]][a[4]] = true;
}
void change(int x) {
  int i;
  for (i = 1; i <= 6; i++) b[i] = a[f[x][i]];
}
int main() {
  int i, j, m, n, k, t, ans = 0;
  scanf(" %s", s);
  for (i = 0; i < 6; i++) c[s[i]]++;
  for (i = 0; i < 6; i++)
    if (c[ss[i]]) {
      c[ss[i]]--;
      a[1] = i;
      break;
    }
  for (a[2] = 0; a[2] < 6; a[2]++)
    if (c[ss[a[2]]]) {
      c[ss[a[2]]]--;
      for (a[3] = 0; a[3] < 6; a[3]++)
        if (c[ss[a[3]]]) {
          c[ss[a[3]]]--;
          for (a[4] = 0; a[4] < 6; a[4]++)
            if (c[ss[a[4]]]) {
              c[ss[a[4]]]--;
              for (a[5] = 0; a[5] < 6; a[5]++)
                if (c[ss[a[5]]]) {
                  c[ss[a[5]]]--;
                  for (a[6] = 0; a[6] < 6; a[6]++)
                    if (c[ss[a[6]]])
                      if (!bo[a[1]][a[2]][a[3]][a[4]][a[5]][a[6]]) {
                        ans++;
                        solve(a);
                        for (i = 2; i <= 6; i++)
                          if (a[i] == a[1]) {
                            change(i);
                            solve(b);
                          }
                      }
                  c[ss[a[5]]]++;
                }
              c[ss[a[4]]]++;
            }
          c[ss[a[3]]]++;
        }
      c[ss[a[2]]]++;
    }
  printf("%d\n", ans);
}
