#include <bits/stdc++.h>
using namespace std;
string str;
int n, i = 0, j = 0, k = 0, ans = 0, cnt = 0, mx = 0, a[26][26][5005] = {0};
int main(void) {
  cin >> str;
  n = str.length();
  str += str;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j - i < n; j++) {
      a[str[i] - 'a'][str[j] - 'a'][j - i]++;
    }
  }
  for (i = 0; i < 26; i++) {
    mx = LLONG_MIN;
    for (j = 1; j < n; j++) {
      cnt = 0;
      for (k = 0; k < 26; k++) {
        if (a[i][k][j] == 1) cnt++;
      }
      mx = max(mx, cnt);
    }
    ans += mx;
  }
  cout << fixed << setprecision(10) << ans / (double)n;
  return 0;
}
