#include <bits/stdc++.h>
using namespace std;
int tab[26][5001][26], ans[5001] = {0};
int solve(string s) {
  memset(tab, 0, sizeof(tab));
  int n = s.length();
  for (int j = 0; j < n; j++) {
    char ch = s[0];
    s.erase(s.begin());
    s += ch;
    for (int k = 0; k < n; k++) tab[s[0] - 'a'][k][s[k] - 'a']++;
  }
  int ret = 0;
  for (int j = 0; j < 26; j++) {
    memset(ans, 0, sizeof(ans));
    for (int i = 0; i < n; i++) {
      for (int k = 0; k < 26; k++)
        if (tab[j][i][k] == 1) {
          ans[i]++;
        }
    }
    int cur = 0;
    for (int j = 0; j < n; j++) cur = max(cur, ans[j]);
    ret += cur;
  }
  return ret;
}
int main() {
  string s;
  cin >> s;
  int n = s.length();
  long double x = solve(s);
  x /= n;
  cout << fixed << setprecision(9) << x << endl;
  return 0;
}
