fabbbhgedd
 abbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaab
 hcdhgcchbdhbeagdcfedgcbaffebgcbcccadeefacbhefgeadfgchabgeebegahfgegahbddedfhffeadcedadgfbeebhgfahhfb
 khjcoijiicdkdianmdolmadobdkcmgifdnffddnjehhbldlkjffknficdcmokfacioiegjedbmadjioomdacbodcajcmonmnlabo
 bababbdaee
 cbbbbcaaca
 gaejllebhn
 eaaebccaeacdecaedcaabbbdeebccdcdaabeeaeeaddbaabdccebecebbbbedbdcbbbbbbecbaddcddcccdcbbadbecddecedbba
 difhjdjbcdjedhiegagdejkbjfcdcdagdijdjajecbheiabfbjdgjdecfhdkgdbkcgcgakkiiggfkgcfadkjhiijkjacgejfhjge
 bbababaaababaabbbbbabbbbbbaaabbabaaaaabbbbbaaaabbbbabaabaabababbbabbabbabaaababbabbababaaaaabaaaabbb
 cadbcdddda
 kpsaloedscghjeaqadfhmlibjepjafdomkkorinrpakondtnrnknbqarbejcenrlsbfgdbsdmkpphbkdnbitjfcofsjibssmmlll
 aaabbbaaaabbbbaaabbbbbaabbbbaaababbaaabbbbaaabbbbababbbbaaabbbbaaabbbbbaabbbbaaabbbbaaabbbb
 ibledofnibedebifmnjdoaijeghajecbkjaebbkofnacceaodiifbhgkihkibddneeiemacodeafeaiiiaoajhmkjffbmmiehebhokfklhbkeoanoajdedjdlkbhenidclagggfhhhldfleccgmjbkhaginlhabkabagikalccndciokabfaebjkndf
 abbacba
 jkeaagakbifeaechkifkdghcjcgighidcgdccfbdbcackfgaebkddabgijkhjkaffkabacekdkjekeccegbecbkecbgbgcacgdackcdfjefaifgbigahkbedidfhjbikejdhejcgideaeejdcegeeccaefbddejkbdkfagfcdjbikbidfggkidcdcic

1.000000000000000
 0.000000000000000
 0.450000000000000
 0.960000000000000
 1.000000000000000
 0.800000000000000
 1.000000000000000
 0.080000000000000
 0.840000000000000
 0.000000000000000
 0.800000000000000
 1.000000000000000
 0.000000000000000
 0.786096256684492
 1.000000000000000
 0.438502673796791

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemE {

  private static class Node{
    Node[] c;
    short childrenCount;
    Node(){
      c = new Node[26];
      childrenCount = 0;
    }
  }

  private static class Trie{
    Node root;
    Trie(){
      root = new Node();
    }
  }

  public static void main(String[] args)throws IOException{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    char[] chars = reader.readLine().toCharArray();
    int n = chars.length;

    int[][][] firstCharLevelCharsCount = new int[26][n + 1][26];

    for(int i = 0; i < n; i++){
      // possible k
      int steps = 0;
      int level = 0;
      for(int j = i; steps < n; steps++, j = (j + 1) % n){
        firstCharLevelCharsCount[chars[i] - 'a'][level][chars[j] - 'a']++;
        level++;
      }
    }
    int res = 0;
    for(int i = 0; i < 26; i++){
      int count = 0;
      for(int j = 1; j < n; j++){
        int unique = 0;
        for(int k = 0; k < 26; k++){
          if(firstCharLevelCharsCount[i][j][k] == 1){
            unique++;
          }
        }
        count = Math.max(count, unique);
      }
      res += count;
    }
    System.out.println(res/(1.0 * n));

  }

  private static void traverse(Node node, int[][] charLevelCount, int level){
    for(int i = 0; i < 26; i++){
      if(node.c[i] != null){
        charLevelCount[level][i]++;
        traverse(node.c[i], charLevelCount, level + 1);
      }
    }
  }

  private static boolean couldBeStart(Node node){
    if(node.childrenCount == 1){
      for(int i = 0; i < 26; i++){
        if(node.c[i] != null){
          return couldBeStart(node.c[i]);
        }
      }
    }

    if(node.childrenCount == 0){
      return true;
    }

    for(int i = 0; i < 26; i++){
      if(node.c[i] != null){
        int leafCount = getLeafCount(node.c[i]);
        if(leafCount > 1){
          return false;
        }
      }
    }
    return true;
  }

  private static int getLeafCount(Node node){
    if(node.childrenCount == 0){
      return 1;
    }
    int ret = 0;
    for(int i = 0; i < 26; i++){
      if(node.c[i] != null) {
        ret += getLeafCount(node.c[i]);
      }
    }
    return ret;
  }
}
