import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); long length = arr.length; HashMap> map = new HashMap<>(); for (int i = 'a'; i <= 'z'; i++) { map.put((char)i, new ArrayList()); } for (int i = 0; i < length; i++) { map.get(arr[i]).add(i); } long sum = 0; for (ArrayList list : map.values()) { int start = 0; for (int x : list) { long size = x - start; sum += size * (size + 1) / 2; start = x + 1; } long size = length - start; sum += size * (size + 1) / 2; } System.out.println((26 * length * (length + 1) / 2 - (double)sum) / length / (length + 1) * 2); } }