#include <bits/stdc++.h>
using namespace std;
string s;
long long int n;
string ls[27][5001];
long long int ccc[27], cct[27];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  n = s.size();
  for (long long int i = 1; i <= n; ++i) {
    string sh;
    for (long long int ps = i - 1; ps <= n - 1; ++ps) sh += s[ps];
    for (long long int ps = 0; ps <= i - 2; ++ps) sh += s[ps];
    ls[sh[0] - 'a' + 1][cct[sh[0] - 'a' + 1]++] = sh;
  }
  long double ans = 0.0;
  for (long long int i = 1; i <= 26; ++i) {
    if (cct[i] == 0) continue;
    long double aans = 0.0;
    for (long long int ps = 1; ps <= n - 1; ++ps) {
      for (long long int j = 1; j <= 26; ++j) ccc[j] = 0;
      for (long long int j = 0; j <= cct[i] - 1; ++j)
        ccc[ls[i][j][ps] - 'a' + 1]++;
      long double cans = 0.0;
      for (long long int j = 1; j <= 26; ++j)
        if (ccc[j] == 1) cans += ((long double)1.0 / (cct[i]));
      aans = max(aans, cans);
    }
    ans += aans * ((long double)cct[i] / (long double)n);
  }
  cout << setiosflags(ios::fixed | ios::showpoint) << setprecision(20);
  cout << (long double)ans << '\n';
}
