#include <bits/stdc++.h>
using namespace std;
bool mark[6];
vector<int> tmp;
string str;
vector<vector<int> > ans;
void c(int now) {
  if (now == 3) {
    vector<int> t;
    t = tmp;
    sort(t.begin(), t.end());
    ans.push_back(t);
    return;
  }
  for (int i = 0; i < 6; i++)
    if (!mark[i])
      for (int j = i + 1; j < 6; j++)
        if (!mark[j]) {
          tmp[now] = str[i] * 100 + str[j];
          mark[i] = mark[j] = 1;
          c(now + 1);
          mark[i] = mark[j] = 0;
        }
}
bool check(int t) {
  int y = t % 100;
  int x = t / 100;
  if (x == y) return 1;
  return 0;
}
int main() {
  cin >> str;
  sort(str.begin(), str.end());
  tmp.push_back(0);
  tmp.push_back(0);
  tmp.push_back(0);
  c(0);
  sort(ans.begin(), ans.end());
  int t = unique(ans.begin(), ans.end()) - ans.begin();
  int k = t * 2;
  for (int i = 0; i < t; i++) {
    if (ans[i][0] == ans[i][1] || ans[i][1] == ans[i][2])
      k--;
    else if (check(ans[i][0]) || check(ans[i][1]) || check(ans[i][2]))
      k--;
  }
  cout << k << endl;
}
