#include <bits/stdc++.h>
using namespace std;
char a[10005];
int dp[30][30][10005];
int ans;
int main() {
  scanf("%s", a + 1);
  int n = strlen(a + 1);
  for (int i = 1; i <= n; ++i) a[i + n] = a[i];
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= i + n - 1; ++j)
      dp[a[i] - 'a'][a[j] - 'a'][j - i + 1]++;
  for (int i = 0; i <= 25; ++i) {
    int ma = 0;
    for (int j = 1; j <= n; ++j) {
      int sum = 0;
      for (int k = 0; k <= 25; ++k)
        if (dp[i][k][j] == 1) sum++;
      ma = max(ma, sum);
    }
    ans += ma;
  }
  printf("%.14f\n", (double)ans / n);
}
