#include <bits/stdc++.h>
using namespace std;
string x;
map<string, int> M;
void solve1(string a) {
  if (a < x) x = a;
  string b;
  b = a[3];
  b += a[2];
  b += a[0];
  b += a[1];
  b += a[4];
  b += a[5];
  if (b < x) x = b;
  b = a[1];
  b += a[0];
  b += a[3];
  b += a[2];
  b += a[4];
  b += a[5];
  if (b < x) x = b;
  b = a[2];
  b += a[3];
  b += a[1];
  b += a[0];
  b += a[4];
  b += a[5];
  if (b < x) x = b;
}
void solve(string a) {
  if (a < x) x = a;
  string b;
  solve1(a);
  b = a[4];
  b += a[5];
  b += a[2];
  b += a[3];
  b += a[1];
  b += a[0];
  solve1(b);
  b = a[1];
  b += a[0];
  b += a[2];
  b += a[3];
  b += a[5];
  b += a[4];
  solve1(b);
  b = a[5];
  b += a[4];
  b += a[2];
  b += a[3];
  b += a[0];
  b += a[1];
  solve1(b);
}
int main() {
  int ans = 0;
  string s;
  cin >> s;
  string a, b;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 6; j++) {
      if (i != j)
        for (int k = 0; k < 6; k++) {
          if (k != i && k != j)
            for (int l = 0; l < 6; l++) {
              if (l != i && l != j && l != k)
                for (int m = 0; m < 6; m++) {
                  if (m != i && m != j && m != k && m != l)
                    for (int n = 0; n < 6; n++) {
                      if (n != i && n != j && n != k && n != l && n != m) {
                        b = s[i];
                        b += s[j];
                        b += s[k];
                        b += s[l];
                        b += s[m];
                        b += s[n];
                        a = b;
                        x = a;
                        solve(b);
                        b = a[0];
                        b += a[1];
                        b += a[5];
                        b += a[4];
                        b += a[2];
                        b += a[3];
                        solve(b);
                        b = a[0];
                        b += a[1];
                        b += a[3];
                        b += a[2];
                        b += a[5];
                        b += a[4];
                        solve(b);
                        b = a[0];
                        b += a[1];
                        b += a[4];
                        b += a[5];
                        b += a[3];
                        b += a[2];
                        solve(b);
                        if (M.find(x) == M.end()) {
                          ans++;
                          M[x] = 1;
                        }
                      }
                    }
                }
            }
        }
    }
  }
  printf("%d\n", ans);
  return 0;
}
