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.util.*;
import java.io.*;

public class E {

	public static class alw {
		
		ArrayList<Integer> al;
		int c;
		
		public alw() {
			al = new ArrayList<Integer>();
			c = 0;
		}
	}

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
		char[] ree = in.readLine().toCharArray();
		int siz = ree.length;
		alw[] arr = new alw[26];
		for(int i = 0; i < 26; i++) arr[i] = new alw();
		for(int i = 0; i < ree.length; i++) {
			//System.out.println("Adding to " + (ree[i]-'a'));
			arr[(ree[i]-'a')].al.add(i);
			arr[(ree[i]-'a')].c++;
		}
		int good = 0;
		for(int i = 0; i < 26; i++) {
			if(arr[i].c == 0) continue;
			else {
				int best = 0;
				for(int os = 1; os < ree.length; os++) {
					int[] chk = new int[26];
					boolean gucci = true;
					for(int nnn : arr[i].al) {
						chk[(ree[(nnn + os) % siz] - 'a')]++;
					}
					int resss = 0;
					for(int ii = 0; ii < 26; ii++) {
						if(chk[ii] == 1) resss++;
					}
					if(resss > best) best = resss;
				}
				good += best;
			}
		}
		double ggg = (double) good;
		double total = (double) siz;
		double res = ggg / total;
		out.write(res + "\n");
		out.flush();
	}
}