#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
const int maxn = (long long)2e5 + 5;
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
int num[30];
int cnt[30][5005][30];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    ++num[s[i] - 'a'];
    for (int j = (i + 1) % s.size(), k = 1; j != i;
         j = (j + 1) % s.size(), ++k) {
      ++cnt[s[i] - 'a'][k][s[j] - 'a'];
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; ++i) {
    if (num[i] == 0) continue;
    int maxx = 0;
    for (int j = 1; j < s.size(); ++j) {
      int tmp = 0;
      for (int k = 0; k < 26; ++k) {
        if (cnt[i][j][k] == 1) {
          ++tmp;
        }
      }
      maxx = max(tmp, maxx);
    }
    ans += maxx;
  }
  cout << fixed << setprecision(10) << ans * 1.0 / s.size();
  return 0;
}
