#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int n = (int)(s).size();
  vector<int> palabra;
  vector<int> apariciones[26];
  for (int i = (0); i < (n); i++) {
    palabra.push_back(s[i] - 'a');
    apariciones[s[i] - 'a'].push_back(i);
  }
  int total = 0;
  for (int i = (0); i < (26); i++) {
    if ((int)(apariciones[i]).size() == 0) continue;
    int mejor = 0;
    for (int j = (1); j < (n); j++) {
      vector<int> cant(26, 0);
      for (int pos : apariciones[i]) {
        int guessed = palabra[(pos + j) % n];
        cant[guessed]++;
      }
      int unicas = 0;
      for (int q = (0); q < (26); q++) {
        if (cant[q] == 1) {
          unicas++;
        }
      }
      mejor = max(mejor, unicas);
    }
    total += mejor;
  }
  cout << setprecision(15) << fixed << 1.0 * total / n << "\n";
}
