#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int n = s.length();
  double nr = 0, dr = n;
  s += s;
  vector<string> v[26];
  for (int i = 0; i < n; i++) {
    v[s[i] - 'a'].push_back(s.substr(i, n));
  }
  for (int i = 0; i < 26; i++) {
    int m = v[i].size();
    int add = 0;
    for (int j = 1; j < n; j++) {
      map<char, int> mp;
      for (int k = 0; k < m; k++) {
        mp[v[i][k][j]]++;
      }
      int cnt = 0;
      for (auto x : mp)
        if (x.second == 1) cnt++;
      add = max(add, cnt);
    }
    nr += add;
  }
  printf("%.9lf", nr / dr);
}
