#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int N = 1e5 + 5;
char str[N];
int vis[26][26];
int Max[N][26];
int main() {
  scanf("%s", str);
  int ans = 0;
  int len = strlen(str);
  for (int to = 1; to < len; to++) {
    memset(vis, 0, sizeof(vis));
    int cnt = 0;
    for (int i = 0; i < len; i++) {
      int p = str[i] - 'a';
      int j = i + to;
      if (j >= len) j -= len;
      if (vis[p][str[j] - 'a'] == 0)
        Max[to][p]++, vis[p][str[j] - 'a'] = 1;
      else if (vis[p][str[j] - 'a'] == 1) {
        Max[to][p]--, vis[p][str[j] - 'a'] = 2;
      }
    }
  }
  for (int j = 0; j < 26; j++) {
    int cnt = 0;
    for (int i = 0; i < len; i++) {
      if (Max[i][j] > cnt) cnt = Max[i][j];
    }
    ans += cnt;
  }
  printf("%f", 1.0 * ans / len);
  return 0;
}
