#include <bits/stdc++.h>
using namespace std;
vector<int> pos[30];
int cnt[26];
int main() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; ++i) pos[s[i] - 'a'].push_back(i);
  int ans = 0;
  for (int i = 0; i < 26; ++i) {
    int maxi = 0;
    for (int j = 1; j < n; ++j) {
      int sum = 0;
      for (int k = 0; k < pos[i].size(); ++k) {
        int x = pos[i][k] + j;
        if (x >= n) x -= n;
        cnt[s[x] - 'a']++;
      }
      for (int k = 0; k < 26; ++k) {
        if (cnt[k] == 1) sum++;
        cnt[k] = 0;
      }
      maxi = max(maxi, sum);
    }
    ans += maxi;
  }
  printf("%.7f\n", ans * 1.0 / n);
  return 0;
}
