#include <bits/stdc++.h>
using namespace std;
vector<string> pos;
int n;
double solve(vector<int>& group) {
  double szansa = 0;
  for (int i = 0; i < n; i++) {
    map<char, int> lit;
    for (auto g : group) {
      lit[pos[g][i]]++;
    }
    double zgadne = 0;
    for (auto ele : lit) {
      zgadne += (ele.second == 1) ? 1 : 0;
    }
    szansa = max(szansa, zgadne);
  }
  return szansa;
}
int main() {
  ios_base::sync_with_stdio(0);
  string first;
  cin >> first;
  n = int(first.size());
  for (int i = 0; i < n; i++) {
    pos.push_back(first);
    rotate(first.begin(), first.begin() + 1, first.end());
  }
  sort(pos.begin(), pos.end());
  int res = 0;
  for (int i = 0; i < n; i++) {
    vector<int> group = {i};
    while (i + 1 < n and pos[i][0] == pos[i + 1][0]) {
      group.push_back(++i);
    }
    res += solve(group);
  }
  cout << fixed << setprecision(15) << 1.0 * res / n << "\n";
  return 0;
}
