#include <bits/stdc++.h>
using i8 = char;
using u8 = unsigned char;
using i16 = short int;
using u16 = unsigned short int;
using i32 = long int;
using u32 = unsigned long int;
using i64 = long long int;
using u64 = unsigned long long int;
using f32 = float;
using f64 = double;
using f80 = long double;
using namespace std;
i64 M[26][5010][26];
i64 C[26];
int main(void) {
  string s;
  cin >> s;
  i64 l = s.size();
  for (i64 i = 0; i < l; ++i) {
    C[s[i] - 'a']++;
    for (i64 k = 0, j = (i + 1) % l; j != i; ++k, j = (j + 1) % l) {
      M[s[i] - 'a'][k][s[j] - 'a']++;
    }
  }
  double res = 0.0;
  for (i64 i = 0; i < 26; ++i) {
    if (C[i] == 0) continue;
    i64 ma = 0;
    for (i64 j = 0; j < l; ++j) {
      i64 count = 0;
      for (i64 k = 0; k < 26; ++k) {
        if (M[i][j][k] == 1) ++count;
      }
      ma = max(ma, count);
    }
    if (ma > 0) {
      res += (((double)C[i]) / ((double)l)) * (((double)ma) / ((double)C[i]));
    }
  }
  cout << fixed << setprecision(8) << res << endl;
  return 0;
}
