#include <bits/stdc++.h>
using namespace std;
char _;
int n, dp[28][5005][28], good[28][5005], tot[28];
string s, t;
double c;
int main() {
  cin >> s;
  n = s.size();
  t = s + s;
  for (int l = 0; l < n; ++l) {
    tot[s[l] - 'a']++;
    for (int l2 = 0; l2 < n; ++l2) {
      dp[s[l] - 'a'][l2][t[l + l2] - 'a']++;
    }
  }
  bool b, f;
  for (int l = 0; l < n; ++l) {
    for (int l2 = 0; l2 < n; ++l2) {
      if (dp[s[l] - 'a'][l2][t[l + l2] - 'a'] == 1) good[s[l] - 'a'][l2]++;
    }
  }
  int hi = 0;
  for (int l = 0; l < 26; ++l) {
    hi = 0;
    for (int l2 = 0; l2 < n; ++l2) {
      hi = max(hi, good[l][l2]);
    }
    c += hi;
  }
  c /= n;
  printf("%.8f", c);
  return 0;
}
