#include <bits/stdc++.h>
using namespace std;
const int MAXK = 30;
const int MAXN = 5005;
const double ONE = 1.0;
int n, ans;
char c[MAXN];
int dp[MAXK][MAXK][MAXN];
int main() {
  scanf("%s", c);
  n = strlen(c);
  for (int i = 0; i < n; i++)
    for (int j = 1; j < n; j++) dp[c[i] - 'a'][c[(i + j) % n] - 'a'][j]++;
  for (int i = 0; i < 26; i++) {
    int ret = 0;
    for (int k = 1; k < n; k++) {
      int su = 0;
      for (int j = 0; j < 26; j++)
        if (dp[i][j][k] == 1) su++;
      ret = max(ret, su);
    }
    ans += ret;
  }
  printf("%.14f\n", ONE * ans / n);
}
