#include <bits/stdc++.h>
using namespace std;
long long dp[27][27][5001];
signed main() {
  string s;
  cin >> s;
  for (long long i = 0; i < s.size(); i++) {
    for (long long j = i + 1; j < s.size(); j++) {
      dp[s[i] - 'a'][s[j] - 'a'][j - i]++;
    }
    for (long long j = 0; j < i; j++) {
      dp[s[i] - 'a'][s[j] - 'a'][s.size() - i + j]++;
    }
  }
  long long maxi = 0;
  long long sum = 0, cnt = 0;
  for (long long i = 0; i < 26; i++) {
    maxi = 0;
    for (long long q = 1; q <= s.size(); q++) {
      cnt = 0;
      for (long long j = 0; j < 26; j++) {
        if (dp[i][j][q] == 1) cnt++;
      }
      maxi = max(maxi, cnt);
    }
    sum += maxi;
  }
  long double q = s.size() / 1.00;
  long double kek = sum / 1.00;
  cout << fixed << setprecision(7) << (kek / q);
  return 0;
}
