#include <bits/stdc++.h>
using namespace std;
const long long int Maxn3 = 1e3 + 10;
const long long int Maxn4 = 1e4 + 10;
const long long int Maxn5 = 1e5 + 10;
const long long int Maxn6 = 1e6 + 10;
const long long int Maxn7 = 1e7 + 10;
const long long int Maxn8 = 1e8 + 10;
const long long int Maxn9 = 1e9 + 10;
const long long int Maxn18 = 1e18 + 10;
const long long int Mod1 = 1e7 + 7;
const long long int Mod2 = 1e9 + 7;
const long long int LLMax = LLONG_MAX;
const long long int LLMin = LLONG_MIN;
const long long int INTMax = INT_MAX;
const long long int INTMin = INT_MIN;
long long int mn = LLMax, mx = LLMin;
int l, pos[26][5010], pc[26], cnt[26];
char s[5010];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int l = 0, ans = 0;
  cin >> s;
  for (; s[l]; l++)
    ;
  for (long long int i = 0; i < l; i++) pos[s[i] - 'a'][pc[s[i] - 'a']++] = i;
  for (long long int c = 0; c < 26; c++) {
    long long int m = 0;
    for (long long int i = 1; i < l; i++) {
      for (long long int j = 0; j < pc[c]; j++)
        cnt[s[(pos[c][j] + i) % l] - 'a']++;
      long long int ss = 0;
      for (long long int j = 0; j < 26; j++) ss += cnt[j] == 1, cnt[j] = 0;
      ((m) = max((m), (ss)));
    }
    ans += m;
  }
  return printf("%.15lf", ans * 1.0 / l), 0;
}
