#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 100;
const int M = 30;
int n;
string s;
string t;
int mat[M][M][N];
int ones[N];
int ans;
long double javab;
set<char> g;
bool mark[30];
int chand[30];
bool oomade[30];
int main() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    g.insert(s[i]);
    chand[s[i] - 'a']++;
    oomade[s[i] - 'a'] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n + i; j++) {
      int y = j % n;
      int f = (int)s[i] - (int)'a';
      int l = (int)s[y] - (int)'a';
      mat[f][l][j - i]++;
    }
  }
  for (int i = 0; i < 26; i++) {
    if (oomade[i] == 1) {
      for (int j = 0; j < n; j++) {
        int tmp = 0;
        for (int k = 0; k < 26; k++) {
          if (mat[i][k][j] == 1) {
            tmp++;
          }
        }
        ones[i] = max(ones[i], tmp);
      }
      ans += ones[i];
    }
  }
  javab = (long double)ans / (n);
  cout << fixed << setprecision(10) << javab;
}
