#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string str;
  cin >> str;
  int siz = str.length();
  int arr[26][siz][26];
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < siz; j++) {
      for (int k = 0; k < 26; k++) {
        arr[i][j][k] = 0;
      }
    }
  }
  for (int i = 0; i < siz; i++) {
    for (int j = 0; j < siz; j++) {
      int dis;
      if (i < j) {
        dis = j - i;
      } else if (i > j) {
        dis = j + siz - i;
      } else {
        continue;
      }
      arr[str[i] - 'a'][dis][str[j] - 'a']++;
    }
  }
  int final = 0;
  for (int i = 0; i < 26; i++) {
    int ans = 0;
    for (int j = 1; j < siz; j++) {
      int poss = 0;
      for (int k = 0; k < 26; k++) {
        if (arr[i][j][k] == 1) {
          poss++;
        }
      }
      ans = max(ans, poss);
    }
    final += ans;
  }
  cout << fixed;
  cout << setprecision(8);
  cout << final / (double)siz;
}
