#include <bits/stdc++.h>
using namespace std;
int dp[5005][26][26];
int main() {
  int l, answer, now, maxi;
  char str[10005];
  scanf("%s", &str);
  l = strlen(str);
  for (int i = l; i < l + l; i++) {
    str[i] = str[i - l];
  }
  for (int i = 0; i < l; i++) {
    for (int j = i + 1; j < i + l; j++) {
      dp[j - i][str[i] - 'a'][str[j] - 'a']++;
    }
  }
  answer = 0;
  for (int i = 0; i < 26; i++) {
    maxi = 0;
    for (int j = 0; j < l; j++) {
      now = 0;
      for (int k = 0; k < 26; k++) {
        if (dp[j][i][k] == 1) {
          now++;
        }
      }
      maxi = max(maxi, now);
    }
    answer += maxi;
  }
  printf("%.10f\n", answer * 1.0 / l);
  return 0;
}
