#include <bits/stdc++.h>
using namespace std;
constexpr int N = 5000 + 10;
int cnt[N], now, c;
string s;
vector<int> pos[N];
double all;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  for (int i = 0; i < (int)s.size(); i++) pos[s[i] - 'a'].push_back(i);
  for (int i = 0; i < 26; i++) {
    now = 0;
    for (int j = 1; j < (int)s.size(); j++) {
      memset(cnt, 0, sizeof(cnt));
      for (auto k : pos[i]) {
        int p = k + j;
        p %= (int)s.size();
        cnt[s[p] - 'a']++;
      }
      c = 0;
      for (int k = 0; k < 26; k++)
        if (cnt[k] == 1) c++;
      now = max(now, c);
    }
    all += now;
  }
  all /= (int)s.size();
  printf("%.12f\n", all);
  return 0;
}
