#include <bits/stdc++.h>
using namespace std;
int cnt[30], vaz[30], vaz1[30];
char sir[10010];
vector<int> v[30];
int main() {
  double sol = 0;
  scanf("%s", sir + 1);
  int l = strlen(sir + 1);
  for (int i = 1; i <= l; i++) {
    cnt[sir[i] - 'a']++;
    v[sir[i] - 'a'].push_back(i);
  }
  for (int i = 1; i <= l; i++) sir[i + l] = sir[i];
  for (int i = 0; i < 26; i++) {
    if (v[i].size() == 0) continue;
    int nr = 0;
    for (int j = 1; j <= l; j++) {
      int c = 0;
      for (int k = 0; k < v[i].size(); k++) {
        int poz = v[i][k];
        vaz[sir[poz + j] - 'a']++;
      }
      for (int k = 0; k < v[i].size(); k++) {
        int poz = v[i][k];
        if (vaz[sir[poz + j] - 'a'] == 1) c++;
      }
      nr = max(nr, c);
      for (int k = 0; k < 26; k++) vaz[k] = 0;
    }
    sol += 1.0 * nr / l;
  }
  printf("%.10f", sol);
  return 0;
}
