#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
inline void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string digits = "0123456789";
void solve() {
  vector<long long> ind[30];
  string s;
  cin >> s;
  long long n = s.length();
  for (long long i = 0; i < n; i++) ind[s[i] - 'a'].push_back(i);
  double ans = 0;
  s = s + s;
  long long p[30] = {0};
  for (long long i = 0; i < 26; i++) {
    for (long long len = 1; len < n; len++) {
      long long c[30] = {0};
      for (long long l = 0; l < ind[i].size(); l++) {
        c[s[ind[i][l] + len] - 'a']++;
      }
      long long cnt = 0;
      for (long long j = 0; j < 30; j++)
        if (c[j] == 1) cnt++;
      p[i] = max(p[i], cnt);
    }
    ans += p[i] * 1. / n;
  }
  cout << setprecision(15) << fixed << ans;
}
