#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int solve();
void precomp();
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  if (0) cin >> t;
  precomp();
  for (int tc = 1; tc <= t; tc++) {
    if (0 && 0) cout << "Case #" << tc << ": ";
    solve();
  }
}
void precomp() { return; }
int cnt[26][26], ans[26], tmp[26];
string s;
int solve() {
  cin >> s;
  for (int i = 1; i <= s.size(); i++) {
    memset(cnt, 0, sizeof(cnt));
    memset(tmp, 0, sizeof(tmp));
    for (int j = 0; j < s.size(); j++)
      cnt[s[j] - 'a'][s[(j + i) % s.size()] - 'a']++;
    for (int j = 0; j < s.size(); j++)
      if (cnt[s[j] - 'a'][s[(i + j) % s.size()] - 'a'] == 1) tmp[s[j] - 'a']++;
    for (int j = 0; j < 26; j++) ans[j] = max(ans[j], tmp[j]);
  }
  int tot = 0;
  for (int i = 0; i < 26; i++) tot += ans[i];
  long double ans = (long double)tot / (long double)s.size();
  cout << fixed << setprecision(10);
  cout << ans << endl;
  return 0;
}
