import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); long[] use = new long[26]; for(int i = 0; i < 26; i++) { use[i] = -1; } long[] dis = new long[s.length()]; for(int i = 0; i < s.length(); i++) { int t = s.charAt(i) - 97; dis[i] = i - use[t]; use[t] = i; } long[] dp = new long[s.length()]; dp[0] = 1; for(int i = 1; i < s.length(); i++) { dp[i] = dp[i - 1] + dis[i]; } long sa = s.length(); long a = (sa * (sa - 1)) / 2 + sa; long sum = 0; for(int i = 0; i < s.length(); i++) { sum += dp[i]; } double ans = (double)sum / (double)a; System.out.println(ans); } }