#include <bits/stdc++.h>
using namespace std;
vector<int> v[30];
string s;
int vis[30];
double ans;
int main() {
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    int x = s[i] - 'a' + 1;
    v[x].push_back(i);
  }
  s += s;
  for (int i = 1; i <= 26; i++) {
    if (v[i].size() == 0) continue;
    memset(vis, 0, sizeof(vis));
    int nowans = 0;
    for (int j = 1; j <= n; j++) {
      memset(vis, 0, sizeof(vis));
      int nans = 0;
      for (auto k : v[i]) {
        vis[s[k + j] - 'a']++;
        if (vis[s[k + j] - 'a'] == 1)
          nans++;
        else if (vis[s[k + j] - 'a'] == 2)
          nans--;
      }
      nowans = max(nowans, nans);
    }
    ans += (double)nowans / (double)n;
  }
  printf("%.7lf", ans);
  return 0;
}
