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

public class R468_E {
	FastScanner in;
	PrintWriter out;

	public void solve() {
		String s = in.next();
		int n = s.length();

		ArrayList<Integer> a[] = new ArrayList[26];
		for (int i = 0; i < 26; i++) {
			a[i] = new ArrayList<Integer>();
		}

		for (int i = 0; i < n; i++) {
			a[s.charAt(i) - 'a'].add(i);
		}

		double sum = 0;
		for (int i = 0; i < 26; i++) {
			if (a[i].isEmpty())
				continue;

			boolean hit = false;
			double best = 0;
			for (int d = 1; d < n; d++) {
				HashMap<Character, Integer> found = new HashMap<Character, Integer>();
				for (int x : a[i]) {
					if (!found.containsKey(s.charAt((x + d) % n))) {
						found.put(s.charAt((x + d) % n), 1);
					} else {
						found.put(s.charAt((x + d) % n), found.get(s.charAt((x + d) % n)) + 1);
					}
				}
				double lbest = 0;
				for (Character x : found.keySet()) {
					if (found.get(x) == 1) {
						lbest++;
					}
				}
				best = Math.max(best, lbest);
			}

			sum += best;

			// if (!hit) {
			// sum += 1D * a[i].size() / (n-1);
			// }
		}

		out.println(sum / n);
	}

	public void run() {
		in = new FastScanner();
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		solve();
		out.close();
	}

	class FastScanner {
		StringTokenizer st;
		BufferedReader br;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		new R468_E().run();
	}
}
