#include <bits/stdc++.h>
using namespace std;
int check(vector<string> v) {
  int max = INT_MIN;
  for (int i = 0; i < v[0].size(); i++) {
    int m[26];
    for (int i1 = 0; i1 < 26; i1++) m[i1] = 0;
    int t = 0;
    for (int j = 0; j < v.size(); j++) {
      if (m[v[j][i] - 'a'] == 0) {
        t++;
        m[v[j][i] - 'a'] = 1;
      } else if (m[v[j][i] - 'a'] == 1) {
        t--;
        m[v[j][i] - 'a'] = 2;
      }
    }
    if (t > max) max = t;
  }
  return max;
}
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  vector<string> m[26];
  m[s[0] - 'a'].push_back(s);
  for (int i = 0; i < s.size() - 1; i++) {
    string s1(s, i + 1);
    string s2(s, 0, i + 1);
    s1 += s2;
    m[s1[0] - 'a'].push_back(s1);
  }
  float ans = 0;
  float n = s.size() + 0.0;
  for (int i = 0; i < 26; i++) {
    if (m[i].size()) ans += (check(m[i]) / n);
  }
  printf("%0.9f", ans);
}
