#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
  cin >> s;
  n = s.size();
  s += s;
  vector<vector<int>> p(26);
  for (int i = 0; i < n; i++) p[s[i] - 'a'].push_back(i);
  int q = 0;
  for (int c = 0; c < 26; c++) {
    int z = 0;
    for (int l = 1; l < n; l++) {
      vector<int> v(26);
      for (int x : p[c]) v[s[x + l] - 'a']++;
      int w = 0;
      for (int x : v)
        if (x == 1) {
          w++;
        }
      z = max(z, w);
    }
    q += z;
  }
  cout.precision(8);
  cout << fixed << 1. * q / n;
  cin >> n;
}
