#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const int N = 5001;
int dp[N][26][26];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  for (int i = (int)(0); i < (int)(n); i++) {
    int ch = s[i] - 'a';
    for (int j = (int)(0); j < (int)(n); j++) {
      int dh = s[(i + j) % n] - 'a';
      dp[j][ch][dh] += 1;
    }
  }
  int cnt = 0;
  for (int j = (int)(0); j < (int)(26); j++) {
    int ma = 0;
    for (int i = (int)(1); i < (int)(n); i++) {
      int uq = 0;
      for (int k = (int)(0); k < (int)(26); k++) {
        if (dp[i][j][k] == 1) {
          uq++;
        }
      }
      ma = max(ma, uq);
    }
    cnt += ma;
  }
  cout << setprecision(15) << ((double)cnt / (double)n) << "\n";
}
