#include <bits/stdc++.h>
using namespace std;
long long values[26][5005][26];
vector<string> strings;
long long n;
long double calc(char start, long double size) {
  long double max_number_of_unique = 0;
  for (long long i = 0; i < n; i++) {
    long double current_unique = 0;
    for (int j = 0; j < 26; j++) {
      if (values[start - 'a'][i][j] == 1) current_unique++;
    }
    max_number_of_unique = max(current_unique, max_number_of_unique);
  }
  return (size / n) * (max_number_of_unique / size);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  n = s.length();
  map<char, long long> sizes;
  for (long long i = 0; i < n; i++) {
    rotate(s.begin(), s.begin() + 1, s.end());
    sizes[s[0]]++;
    strings.push_back(s);
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      values[strings[i][0] - 'a'][j][strings[i][j] - 'a']++;
    }
  }
  char curr = strings[0][0];
  long double ans = 0;
  for (auto const& x : sizes) {
    ans += calc(x.first, x.second);
  }
  cout << fixed << setprecision(12) << ans << endl;
}
