#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int md = 1e9 + 7;
const double EPS = 1e-15;
string second;
int c[30][10000][30];
int res;
int main() {
  cin >> second;
  second = second + second;
  for (int i = 0; i < int(second.size()) / 2; i++) {
    for (int j = 1; j < int(second.size()) / 2; j++) {
      c[second[i] - 'a'][j][second[i + j] - 'a']++;
    }
  }
  for (int i = 0; i < 26; i++) {
    int tmp = 0;
    for (int j = 1; j < int(second.size()) / 2; j++) {
      int now = 0;
      for (int k = 0; k < 26; k++) {
        if (c[i][j][k] == 1) now++;
      }
      tmp = max(tmp, now);
    }
    res += tmp;
  }
  cout << fixed << setprecision(15) << res * 2.0 / int(second.size());
  return 0;
}
