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

// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF931E extends PrintWriter {
	CF931E() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF931E o = new CF931E(); o.main(); o.flush();
	}

	static final int A = 26;
	void main() {
		byte[] cc = sc.next().getBytes();
		int n = cc.length;
		int[][][] kk = new int[A][n][A];
		int[] k1 = new int[A];
		for (int i = 0; i < n; i++) {
			int a = cc[i] - 'a';
			k1[a]++;
			for (int d = 1; d < n; d++) {
				int j = (i + d) % n;
				int b = cc[j] - 'a';
				kk[a][d][b]++;
			}
		}
		double p = 0;
		for (int a = 0; a < A; a++) {
			if (k1[a] == 0)
				continue;
			int u_ = 0, v_ = 1;
			for (int d = 1; d < n; d++) {
				int u = 0, v = 0;
				for (int b = 0; b < A; b++) {
					int k = kk[a][d][b];
					if (k == 1)
						u++;
					v += k;
				}
				if (u_ * v  < u * v_) {
					u_ = u; v_ = v;
				}
			}
			p += (double) k1[a] / n * u_ / v_;
		}
		println(p);
	}
}
