#include <bits/stdc++.h>
using namespace std;
int sum, len;
string s;
int cnt[26][5010][26];
int main() {
  cin >> s;
  sum = 0;
  len = s.length();
  s += s;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < len; i++) {
    for (int j = 1; j < len; j++) {
      cnt[s[i] - 'a'][j][s[i + j] - 'a']++;
    }
  }
  for (int i = 0; i < 26; i++) {
    int mx = 0;
    for (int j = 1; j < len; j++) {
      int tmp = 0;
      for (int k = 0; k < 26; k++)
        if (cnt[i][j][k] == 1) tmp++;
      mx = max(mx, tmp);
    }
    sum += mx;
  }
  printf("%.10lf\n", (double)sum / (double)len);
}
