//package a;

import java.util.Scanner;

public class YoungPhysicist {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner k = new Scanner(System.in);
		int x = k.nextInt();
		int[][] a = new int[3][x];
		int sum = 0;
		int sum2 = 0;
		int sum3 = 0;
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < x; j++) {
				a[i][j] = k.nextInt();
				if (j == 0) {
					sum -= a[i][j];
				} else if (j == 1) {
					sum2 -= a[i][j];
				} else {
					sum3 -= a[i][j];
				}
			}
		}
		if (sum == 0 && sum2 == 0 && sum3 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


//package a;

import java.util.Scanner;

public class YoungPhysicist {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner k = new Scanner(System.in);
		int x = k.nextInt();
		int[][] a = new int[3][x];
		long sum=0;
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < x; j++) {
				a[i][j] = k.nextInt();
			sum+=a[i][j];
			}
		}
if (sum==0) {
	System.out.println("YES");
}
else{
	System.out.println("NO");
}
	}

}


//package a;

import java.util.Scanner;

public class YoungPhysicist {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner k = new Scanner(System.in);
		int x = k.nextInt();
		int[][] a = new int[3][x];
		int sum = 0;
		int sum2 = 0;
		int sum3 = 0;
		for (int i = 0; i < x; i++) {
			for (int j = 0; j < a.length; j++) {
				a[i][j] = k.nextInt();
				if (j == 0) {
					sum += a[i][j];
				} else if (j == 1) {
					sum2 += a[i][j];
				} else {
					sum3 += a[i][j];
				}
			}
		}
		if (sum == 0 && sum2 == 0 && sum3 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


//package a;

import java.util.Scanner;

public class YoungPhysicist {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner k = new Scanner(System.in);
		int x = k.nextInt();
		int[][] a = new int[x][3];
		int sum = 0;
		int sum2 = 0;
		int sum3 = 0;
		for (int i = 0; i < x; i++) {
			for (int j = 0; j < 3; j++) {
				a[i][j] = k.nextInt();
				if (j == 0) {
					sum += a[i][j];
				} else if (j == 1) {
					sum2 += a[i][j];
				} else {
					sum3 += a[i][j];
				}
			}
		}
		if (sum == 0 && sum2 == 0 && sum3 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1= = sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X==0 && Y==0 && Z==0)
         System.out.println("YES");}
      else
    	  System.out.println("NO");
      sc.close()
   }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

   }
}


import java.util.Scanner;
import java.io.FileReader;
import java.io.BufferedReader;
public class Main{
	//static BufferedReader reader;
	//static FileReader file;
	public static void main(String []args){
		try {
		    int xx;
			//file = new FileReader("/home/ahmad/Desktop/java/in.txt");
			//reader = new BufferedReader(file);
		    String x = reader.readLine();
			Scanner input = new Scanner(x);
			long N=input.nextLong();
			String input;
			String[] numbers
			int X, Y, Z;
			int X1, Y1, Z1;
			X=0; Y=0; Z=0;
		} catch (Exception e) {
			System.out.println("Error");
		}

	}
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;

   }
}


import java.util.Scanner;
import java.io.FileReader;
import java.io.BufferedReader;
public class Main{
	//static BufferedReader reader;
	//static FileReader file;
	public static void main(String []args){
		try {
			//file = new FileReader("/home/ahmad/Desktop/java/in.txt");
			//reader = new BufferedReader(file);
		    String x = reader.readLine();
		} catch (Exception e) {
			System.out.println("Error");
		}

	}
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X == 0 && Y == 0 && Z == 0)
         System.out.println("YES");
      else
    	  System.out.println("NO");
      sc.close()
   }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X == 0 && y == 0 && Z == 0)
			System.out.println("YES");
		else
			System.out.println("NO");
      sc.close();
   }
}


import java.util.Scanner;
import java.io.FileReader;
import java.io.BufferedReader;
public class Main{
	//static BufferedReader reader;
	//static FileReader file;
	public static void main(String []args){
		try {
		    int xx;
			//file = new FileReader("/home/ahmad/Desktop/java/in.txt");
			//reader = new BufferedReader(file);
		    String x = reader.readLine();
			Scanner input = new Scanner(x);
			long N=input.nextLong();
			String input;
			String[] numbers
			int X, Y, Z;
			int X1, Y1, Z1;
			X=0; Y=0; Z=0;
		    while (N>0) {

                N=N-1;
		    }

		} catch (Exception e) {
			System.out.println("Error");
		}

	}
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1= sc.nextInt();
          X=X+X1; Y=Y+Y1; Z=Z+Z1;
          N=N-1;
      }

     if (X==0 && Y==0 && Z==0)
         System.out.println("YES");
      else
    	  System.out.println("NO");
      sc.close()
   }
}


import java.util.*;

public class T1{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {   String s   = sc.nextLine();       // read whole line as String
          String[] numbers = s.split(" "); // split by
          X1=Integer.parseInt(numbers[0]);
          Y1=Integer.parseInt(numbers[1]);
          Z1=Integer.parseInt(numbers[2]);
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }
      	  }
    }


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[][] matrix = new int[t][3];
		int[] sums = new int[3];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				matrix[i][j] = in.nextInt();
				sums[j] += matrix[i][j];
			}
		}
		if (sums[0] == 0 && sums[1] == 0 && sums[2] == 0)
			System.out.println("YES");
		else
			System.out.println("NO");
		in.close();
	}
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X == 0 && y == 0 && Z == 0)
			System.out.println("YES");
		else
			System.out.println("NO");
      sc.close()
   }
}


import java.util.*;

public class T1{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {   String s   = sc.nextLine();       // read whole line as String
          String[] numbers = s.split(" "); // split by
          X1=Integer.parseInt(numbers[0]);
          Y1=Integer.parseInt(numbers[1]);
          Z1=Integer.parseInt(numbers[2]);
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }
      if (X==0 && Y==0 && Z==0)
      {System.out.println("Yes");}
      else
      {
    	  System.out.println("NO");;
      }

      }

      /*
      int n      = sc.nextInt();        // read input as integer
      long k     = sc.nextLong();       // read input as long
      double d   = sc.nextDouble();     // read input as double
      String str = sc.next();           // read input as String
      String s   = sc.nextLine();       // read whole line as String
      */
    }
}


import java.util.*;

public class T1{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;

      	  }
    }


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }
     if (X==0 && Y==0 && Z==0)
         System.out.println("YES");
      else
    	  System.out.println("NO");
      sc.close()
   }
}


import java.util.*;

public class T1{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {   String s   = sc.nextLine();       // read whole line as String
           System.out.println(s);;
          String[] numbers = s.split(" "); // split by
          X1=Integer.parseInt(numbers[0]);
          Y1=Integer.parseInt(numbers[1]);
          Z1=Integer.parseInt(numbers[2]);
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X==0 && Y==0 && Z==0)
      {System.out.println("YES");}
      else
      {
    	  System.out.println("NO");;
      }
   }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N== sc.nextInt();
      while (N>0)
      {
          N--;
      }
      /*
      int n      = sc.nextInt();        // read input as integer
      long k     = sc.nextLong();       // read input as long
      double d   = sc.nextDouble();     // read input as double
      String str = sc.next();           // read input as String
      String s   = sc.nextLine();       // read whole line as String
      */
    }
}
Usi


public class Main{
	//static BufferedReader reader;
	//static FileReader file;
	public static void main(String []args){
		try {
		    int x;
		} catch (Exception e) {
			System.out.println("Error");
		}

	}
}


import java.util.Scanner;
import java.io.FileReader;
import java.io.BufferedReader;
public class Main{
	//static BufferedReader reader;
	//static FileReader file;
	public static void main(String []args){
		try {
			//file = new FileReader("/home/ahmad/Desktop/java/in.txt");
			//reader = new BufferedReader(file);
		    String x = reader.readLine();
			Scanner input = new Scanner(x);
			Long N=input.nextLong();
			String input;
			String[] numbers
			Int X, Y, Z;
			Int X1, Y1, Z1;
			X=0; Y=0; Z=0;
		    while (N>0) {
                input = scanner.nextLine();    // get the entire line after the prompt
                String[] numbers = input.split(" "); // split by spaces
                X1=numbers[0];
                Y1=numbers[1];
                Z1=numbers[2];
                X=X+X1;Y=Y+Y1; Z=Z+Z1;
                N--;
		    }
		    if X=0 && Y==0 && Z==0 {
		        printLine("Yes")
		        else
		        printLine("No")
		    }

		} catch (Exception e) {
			System.out.println("Error");
		}

	}
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      while (N>0)
      {
          N=N-1;
      }
      /*
      int n      = sc.nextInt();        // read input as integer
      long k     = sc.nextLong();       // read input as long
      double d   = sc.nextDouble();     // read input as double
      String str = sc.next();           // read input as String
      String s   = sc.nextLine();       // read whole line as String
      */
    }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X == 0)
         {if (Y == 0)
            if (Z == 0)
                System.out.println("YES");}
      else
    	  System.out.println("NO");
      sc.close()
   }
}


import java.util.Scanner;
import java.io.FileReader;
import java.io.BufferedReader;
public class Main{
	//static BufferedReader reader;
	//static FileReader file;
	public static void main(String []args){
		try {
		    int xx;
			//file = new FileReader("/home/ahmad/Desktop/java/in.txt");
			//reader = new BufferedReader(file);
		    String x = reader.readLine();
			Scanner input = new Scanner(x);
			long N=input.nextLong();
			String input;
			String[] numbers
			int X, Y, Z;
			int X1, Y1, Z1;
			X=0; Y=0; Z=0;
		    while (N>0) {
                input = scanner.nextLine();    // get the entire line after the prompt
                String[] numbers = input.split(" "); // split by spaces
                X1=numbers[0];
                Y1=numbers[1];
                Z1=numbers[2];
                X=X+X1;Y=Y+Y1; Z=Z+Z1;
                N--;
		    }

		} catch (Exception e) {
			System.out.println("Error");
		}

	}
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      while (N>0)
      {
          N=N-1;
      }
      /*
      int n      = sc.nextInt();        // read input as integer
      long k     = sc.nextLong();       // read input as long
      double d   = sc.nextDouble();     // read input as double
      String str = sc.next();           // read input as String
      String s   = sc.nextLine();       // read whole line as String
      */
    }
}
Usi


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N== sc.nextInt();
      while (N>0)
      {
          N=N-1;
      }
      /*
      int n      = sc.nextInt();        // read input as integer
      long k     = sc.nextLong();       // read input as long
      double d   = sc.nextDouble();     // read input as double
      String str = sc.next();           // read input as String
      String s   = sc.nextLine();       // read whole line as String
      */
    }
}
Usi


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1= sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X==0 && Y==0 && Z==0)
         System.out.println("YES");}
      else
    	  System.out.println("NO");
      sc.close()
   }
}


import java.util.*;

public class T1{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {   String s   = sc.nextLine();       // read whole line as String
           System.out.println(s);;
          String[] numbers = s.split(" "); // split by
          X1=Integer.parseInt(numbers[0]);
          Y1=Integer.parseInt(numbers[1]);
          Z1=Integer.parseInt(numbers[2]);
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }
      	  }
    }


import java.util.Scanner;
import java.io.FileReader;
import java.io.BufferedReader;
public class Main{
	//static BufferedReader reader;
	//static FileReader file;
	public static void main(String []args){
		try {
		    int xx;
			//file = new FileReader("/home/ahmad/Desktop/java/in.txt");
			//reader = new BufferedReader(file);
		    String x = reader.readLine();
			Scanner input = new Scanner(x);
			long N=input.nextLong();
			String input;
			String[] numbers
			int X, Y, Z;
			int X1, Y1, Z1;
			X=0; Y=0; Z=0;
		    while (N>0) {

                N--;
		    }

		} catch (Exception e) {
			System.out.println("Error");
		}

	}
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X == 0 && Y == 0 && Z == 0)
         System.out.println("YES");
      else
    	  System.out.println("NO");
      sc.close();
   }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X==0 && Y==0 && Z==0)
         System.out.println("YES");
      else
    	  System.out.println("NO");
      sc.close()
   }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      // Use the Scanner class
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      int X, Y, Z;
      X=0; Y=0; Z=0;
      int X1, Y1, Z1;
      while (N>0)
      {
          X1 = sc.nextInt();
          Y1 = sc.nextInt();
          Z1=  sc.nextInt();
          X=X+X1;Y=Y+Y1;Z=Z+Z1;
          N=N-1;
      }

     if (X == 0 && y == 0 && Z == 0)
			System.out.println("YES");
		else
			System.out.println("NO");
   }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <set>
#include <iomanip>

using namespace std;

int main()
{
    ios::sync_with_stdio(0); cin.tie(nullptr);
    string s;
    cin >> s;
    set<pair<char, pair<int, char> > > t, f;
    int all[26];
    for (int i = 0; i < 26; ++i)
        all[i] = 0;
    for (int i = 0; i < s.size(); ++i) {
        ++all[s[i]-'a'];
        int cur = 1; // первый эл-т - s[i]
        for (int j = i+1; j < s.size()+i; ++j) {
            pair<char, pair<int, char> > g = make_pair(s[i], make_pair(cur, s[j % s.size()]));
            if (t.find(g) != t.end()) {
                t.erase(g);
                f.insert(g);
            }
            else if (f.find(g) == f.end())
                t.insert(g);
            ++cur;
        }
    }
    int d[26][s.size()];
    for (int i = 0; i < 26; ++i)
        for (int j = 0; j < s.size(); ++j)
            d[i][j] = 0;
    for (auto i : t)
        ++d[i.first-'a'][i.second.first];
    int ans = 0, y = 0;
    for (int i = 0; i < 26; ++i) {
        if (all[i] == 0) continue;
        int cur = 0;
        for (int j = 0; j < s.size(); ++j)
            cur = max(cur, d[i][j]);
        ans += cur;
        //cout << (char)(i+'a') << ' ' << cur << ' ' << all[i] << '\n';
    }
    cout << fixed << setprecision(10) << (double)ans/s.size();
    return 0;
}


#ifdef _DEV
#define DEV 1
#else
#define DEV 0
#endif

#include <bits/stdc++.h>

using namespace std;

void $main(int testNo);
using ll = long long;
using ld = long double;
int main() {
    int numTests = 1;

    if (DEV) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        cin >> numTests;
    } else {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
    }
    for (int i = 0; i < numTests; ++i) {
        $main(i);
    }
}

void $main(int testNo) {
    string s;
    cin >> s;
    int n;
    n = s.size();
    int good = 0;
    //for (int i = 0; i < n; ++i) {
    //    char c = s[0];
    //
///
//
    //    s.erase(s.begin());
    //    s.push_back(c);
    //}
    vector<vector<int>> m(26);
    for (int i = 0; i < n; ++i) {
        m[s[i] - 'a'].push_back(i);
    }
    for (char c = 'a'; c <= 'z'; ++c) {
        vector<int> pos = m[c - 'a'];
        if (pos.size() == 0) continue;
        int best = -1;
        for (int l = 0; l < n; ++l) {
            vector<int> res(26);
            for (int p : pos) {
                int p2 = (p + l) % n;
                res[s[p2] - 'a']++;
            }
            int goodness = 0;
            for (char c = 'a'; c <= 'z'; ++c) {
                if (res[c - 'a'] == 1) {
                    ++goodness;
                }
            }
            best = max(best, goodness);
        }
        good += best;
    }
    ld ans = ((ld) good) / n;
    cout.setf(cout.fixed);
    cout.precision(15);
    cout << ans << endl;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <random>
#include <ctime>
using namespace std;

// **  ** *****   ***** *    * ***  *   * *  *  * *
// **  ** *           * *    * *  * *  ** *  *  * *
// ****** *****   ***** **** * ***  * * * *  *  * ***
//     ** *           * *  * * *    **  * *  *  * *  *
//     ** *****   ***** **** * *    *   * ******* ***

string s;
vector < int > p[26];
int cnt[26];

int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	/*srand(time(NULL));
	for(int i = 0;i < 5000;i++){
		cout << (char)('a' + (rand() % 10));
	}
	return 0;*/
	cin >> s;
	int diff = 0;
	for(int i = 0;i < s.size();i++){
		p[s[i] - 'a'].push_back(i);
		if(p[s[i] - 'a'].size() == 1)
			diff++;
	}
	int x = s.size();
	double ans = 0.0;
	for(int i = 0;i < 26;i++){
		double now = 0.0;
		for(int j = 1;j < x;j++){
			for(int k = 0;k < 26;k++)
				cnt[k] = 0;
			for(int k = 0;k < p[i].size();k++){
				int ps = (p[i][k]+ j) % x;
				cnt[s[ps] - 'a']++;
			}
			int fgh = 0;
			int ok = 0;
			for(int k = 0;k < 26;k++){
				if(cnt[k] != 0)
					fgh += cnt[k];
				if(cnt[k] == 1)
					ok++;
			}
			now = max(now, (double)ok / (double)fgh);
		}
		ans += (now * (double)p[i].size()) / (double) x;
	}
	cout << fixed << setprecision(10) << ans;

#ifdef _DEBUG
	cout << "\n\n\nTIME: " << clock();
#endif
}


#include <bits/stdc++.h>

//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast", "no-stack-protector")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4", "tune=native", "abm")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define _ inline
#define f first
#define sec second
#define pb push_back
#define ins insert
#define ers erase
#define mk make_pair
#define rsz resize
//#define int ll
#define forn(i, n) for (int i(1); i <= n; i++)
#define fore(i, n) for (int i(0); i < n; i++)

#define next nextt
#define prev prevv
#define left leftt
#define right rightt

const int INF = 1e9 + 10;
const int MOD = 1e9 + 7;
const int P = 239017;
const ll BINF = 1e18 + 10;
const ld EPS = 1e-6;

mt19937 Random(int(time(0)));

int cnt[5010][1010];

_ int get_num(char a, char b) {
    int aa = a - 'a', bb = b - 'a';
    return aa * 30 + bb;
}

_ void source() {
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; i++) {
        for (int j = 1; j < n; j++) {
            cnt[j][get_num(s[0], s[j])]++;
        }
        char ch = s[0];
        s.ers(s.begin());
        s += ch;
    }
    int cur_max = 0;
    for (int i = 1; i < n; i++) {
        int cur = 0;
        for (int j = 0; j <= 900; j++) {
            if (cnt[i][j] == 1) {
                cur++;
            }
        }
        cur_max = max(cur_max, cur);
    }
    cout << fixed << setprecision(10) << ld(cur_max) / ld(n);
}

signed main() {
#ifdef EXTRATERRESTRIAL_
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    source();
    return 0;
}


#include <bits/stdc++.h>

//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast", "no-stack-protector")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4", "tune=native", "abm")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define _ inline
#define f first
#define sec second
#define pb push_back
#define ins insert
#define ers erase
#define mk make_pair
#define rsz resize
//#define int ll
#define forn(i, n) for (int i(1); i <= n; i++)
#define fore(i, n) for (int i(0); i < n; i++)

#define next nextt
#define prev prevv
#define left leftt
#define right rightt

const int INF = 1e9 + 10;
const int MOD = 1e9 + 7;
const int P = 239017;
const ll BINF = 1e18 + 10;
const ld EPS = 1e-6;

mt19937 Random(int(time(0)));

const int lim = 26 * 26 + 25;

int cnt[5010][lim + 10];
int f[26], sum[26][5010];
ld ver[26];

_ int get_num(char a, char b) {
    int aa = a - 'a', bb = b - 'a';
    return aa * 26 + bb;
}

_ void source() {
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; i++) {
        int first_letter = int(s[0] - 'a');
        f[first_letter]++;
        for (int j = 1; j < n; j++) {
            int p = get_num(s[0], s[j]);
            //cout << first_letter << ' ' << j << ' ' << p << endl;
            cnt[j][p]++;
        }
        char ch = s[0];
        s.ers(s.begin());
        s += ch;
    }
    for (int i = 0; i < 26; i++) {
        ver[i] = ld(f[i]) / ld(n);
        //cout << ver[i] << endl;
    }
    ld ans = 0;
    for (int first_letter = 0; first_letter < 26; first_letter++) {
        if (!f[first_letter]) {
            continue;
        }
        int mx = 0, l = first_letter * 26, r = first_letter * 26 + 25;
        for (int pos = 1; pos < n; pos++) {
            int cur = 0;
            for (int i = l; i <= r; i++) {
                if (cnt[pos][i] == 1) {
                    cur++;
                }
            }
            mx = max(mx, cur);
        }
        ans += ver[first_letter] * ld(mx) / ld(f[first_letter]);
    }
    cout << fixed << setprecision(10) << ans;
}

signed main() {
#ifdef EXTRATERRESTRIAL_
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    source();
    return 0;
}


#include <bits/stdc++.h>

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

typedef long long ll;
typedef long double ld;

#define f first
#define s second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define len(x) ((int)x.size())
#define pb push_back
#define mp make_pair
#define lwb lower_bound
#define upb upper_bound

using namespace std;

void my_file_in_out() {
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
}

inline void OK(string t = "") { cerr << "OK " << t << '\n'; }
inline ld time() { return clock() / (ld)CLOCKS_PER_SEC; }
inline void stop(string t = "PROCESS FINISHED") { cerr << t << '\n'; exit(0); }

ll bp(ll c, ll st) {
    if (!st)
        return 1;
    if (st & 1)
        return c * bp(c, st - 1);
    return bp(c * c, st >> 1);
}

namespace VECTOR_MAGIC {
    template <typename T> istream &operator >>(istream &inp, vector <T>& a) {
        for (auto &elem : a)
            inp >> elem;
        return inp;
    }
    template <typename T> ostream &operator <<(ostream &out, vector <T>& a) {
        for (auto &elem : a)
            out << elem << ' ';
        out << endl;
        return out;
    }
    template <typename T> ostream &operator <<(ostream &out, vector <vector <T>>& a) {
        for (auto &elem : a)
            out << elem;
        return out;
    }
    template <typename T> void operator ++(vector <T> &a) {
        for (auto &el : a) el++;
    }
    template <typename T> void operator ++(vector <T> &a, T) {
        for (auto &el : a) el++;
    }
    template <typename T> void operator --(vector <T> &a) {
        for (auto &el : a) el--;
    }
    template <typename T> void operator --(vector <T> &a, T) {
        for (auto &el : a) el--;
    }
    template <typename T> void operator +=(vector <T> &a, T X) {
        for (auto &el : a) el += X;
    }
}

using namespace VECTOR_MAGIC;

mt19937 rnd(time(0));

signed main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    //my_file_in_out();

    int dp[5005][26][26];
    for (int i = 0; i < 5005; i++)
        for (int j = 0; j < 26; j++)
            for (int k = 0; k < 26; k++)
                dp[i][j][k] = 0;

    string a;
    cin >> a;

    int n = len(a);

    a = a + a;
    for (auto &el : a)
        el -= 'a';

    for (int i = 0; i < n; i++)
        for (int j = i; j < i + n; j++)
            dp[j - i][a[i]][a[j]]++;

    ld ans = 0;
    for (int j = 0; j < 26; j++) {
        int c = 0;
        for (int i = 0; i < n; i++) {
            int ver = 0;
            for (int k = 0; k < 26; k++)
                if (dp[i][j][k] == 1)
                    ver++;
            c = max(c, ver);
        }
        ans += c;
    }

    ans = ans / n;

    cout.precision(20);
    cout << fixed << ans;

    return 0;
}


#include <bits/stdc++.h>

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

typedef long long ll;
typedef long double ld;

#define f first
#define s second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define len(x) ((int)x.size())
#define pb push_back
#define mp make_pair
#define lwb lower_bound
#define upb upper_bound

using namespace std;

void my_file_in_out() {
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
}

inline void OK(string t = "") { cerr << "OK " << t << '\n'; }
inline ld time() { return clock() / (ld)CLOCKS_PER_SEC; }
inline void stop(string t = "PROCESS FINISHED") { cerr << t << '\n'; exit(0); }

ll bp(ll c, ll st) {
    if (!st)
        return 1;
    if (st & 1)
        return c * bp(c, st - 1);
    return bp(c * c, st >> 1);
}

namespace VECTOR_MAGIC {
    template <typename T> istream &operator >>(istream &inp, vector <T>& a) {
        for (auto &elem : a)
            inp >> elem;
        return inp;
    }
    template <typename T> ostream &operator <<(ostream &out, vector <T>& a) {
        for (auto &elem : a)
            out << elem << ' ';
        out << endl;
        return out;
    }
    template <typename T> ostream &operator <<(ostream &out, vector <vector <T>>& a) {
        for (auto &elem : a)
            out << elem;
        return out;
    }
    template <typename T> void operator ++(vector <T> &a) {
        for (auto &el : a) el++;
    }
    template <typename T> void operator ++(vector <T> &a, T) {
        for (auto &el : a) el++;
    }
    template <typename T> void operator --(vector <T> &a) {
        for (auto &el : a) el--;
    }
    template <typename T> void operator --(vector <T> &a, T) {
        for (auto &el : a) el--;
    }
    template <typename T> void operator +=(vector <T> &a, T X) {
        for (auto &el : a) el += X;
    }
}

using namespace VECTOR_MAGIC;

mt19937 rnd(time(0));

signed main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    //my_file_in_out();

    int dp[500][26][26];
    for (int i = 0; i < 500; i++)
        for (int j = 0; j < 26; j++)
            for (int k = 0; k < 26; k++)
                dp[i][j][k] = 0;

    string a;
    cin >> a;

    int n = len(a);

    a = a + a;
    for (auto &el : a)
        el -= 'a';

    for (int i = 0; i < n; i++)
        for (int j = i; j < i + n; j++)
            dp[j - i][a[i]][a[j]]++;

    ld ans = 0;
    for (int j = 0; j < 26; j++) {
        int c = 0;
        for (int i = 0; i < n; i++) {
            int ver = 0;
            for (int k = 0; k < 26; k++)
                if (dp[i][j][k] == 1)
                    ver++;
            c = max(c, ver);
        }
        ans += c;
    }

    ans = ans / n;

    cout.precision(20);
    cout << fixed << ans;

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <iomanip>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<string> v[26];
    for (int i = 0; i < n; ++i) {
        v[s[0] - 'a'].push_back(s);
        s = s.substr(1, n - 1) + s[0];
    }
    int tsz = 0, tsc = n;
    for (int i = 0; i < 26; ++i) {
        int bsz = 0;
        for (int j = 0; j < n; ++j) {
            int csz = 0;
            vector<int> c(26);
            for (int k = 0; k < (int)v[i].size(); ++k) {
                c[v[i][k][j] - 'a']++;
            }
            for (int k = 0; k < 26; ++k) {
                if (c[k] == 1) {
                    csz++;
                }
            }
            bsz = max(bsz, csz);
        }
        tsz += bsz;
    }
    double dc = tsz;
    double nn = n;
    cout << fixed << setprecision(15) << dc / nn << endl;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <iomanip>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<string> v[26];
    for (int i = 0; i < n; ++i) {
        v[s[0] - 'a'].push_back(s);
        s = s.substr(1, n - 1) + s[0];
    }
    int tsz = 0, tsc = n;
    for (int i = 0; i < 26; ++i) {
        int bsz = 0;
        for (int j = 0; j < n; ++j) {
            int csz = 0;
            vector<int> c(26);
            for (int k = 0; k < (int)v[i].size(); ++k) {
                c[s[k] - 'a']++;
            }
            for (int k = 0; k < 26; ++k) {
                if (c[k] == 1) {
                    csz++;
                }
            }
            bsz = max(bsz, csz);
        }
        tsz += bsz;
    }
    double dc = tsz;
    double nn = n;
    cout << fixed << setprecision(15) << dc / nn << endl;
}

//vector<int> sum, d;
//
//void push(int cv, int len) {
//    sum[cv] += d[cv] * len;
//    if (len > 1) {
//        d[cv * 2] += d[cv];
//        d[cv * 2 + 1] += d[cv];
//    }
//    d[cv] = 0;
//}
//
//int get(int ind, int l = 0, int r = sum.size() / 4, int cv =  1) {
//    push(cv, r - l);
//    if (l + 1 == r) {
//        return sum[cv];
//    }
//    int mid = l + (r - l) / 2;
//    if (ind < mid) {
//        return get(ind, l, mid, cv * 2);
//    }
//    else {
//        return get(ind, mid, r, cv * 2 + 1);
//    }
//}
//
//void update(int ll, int rr, int l = 0, int r = sum.size() / 4, int cv = 1) {
//    if (ll >= rr) {
//        return;
//    }
//    push(cv, r - l);
//    if (ll == l && rr == r) {
//        d[cv] += 1;
//        push(cv, r - l);
//        return;
//    }
//    int mid = l + (r - l) / 2;
//    update(ll, min(mid, rr), l, mid, cv * 2);
//    update(max(ll, mid), rr, mid, r, cv * 2 + 1);
//}
//
//int main() {
//    int n, m;
//    cin >> n >> m;
//    sum.resize(m * 4);
//    d.resize(m * 4);
//    for (int i = 0; i < n; ++i) {
//        int l, r;
//        cin >> l >> r;
//        update(l - 1, r);
//    }
//    unordered_map<int, int> map1;
//    for (int i = 0; i < m; ++i) {
//        int csum = get(i);
//        if (map1.find(csum) == map1.end()) {
//            map1[csum] = 1;
//        }
//        else {
//            map1[csum]++;
//        }
//    }
//    vector<int> v;
//    for (auto i : map1) {
//        v.push_back(i.second);
//    }
//    sort(v.begin(), v.end());
//    cout << min(m, v.back() + 1) << endl;
//}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define all(a) a.begin(), a.end()
#define pll pair <long long, long long>

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll g[26] = {0};
    ll tm = 0;
    ll used[26] = {0};
    string s;
    cin >> s;
    vector <ll> alf[26];
    ll n = s.length();
    for (int i = 0; i < n; i++)
    {
        alf[s[i] - 'a'].push_back(i);
    }
    ll ans = 0;
    for (int i = 0; i < 26; i++)
    {
        ll mx = 0;
        for (int k = 0; k < n; k++)
        {
            tm++;
            ll mm = 0;
            //cout << "\n";
            // cout << tm << "\n";
            for (int j = 0; j < alf[i].size(); j++)
            {
                int ch = s[(alf[i][j] + k) % n] - 'a';
                //cout << ch << " " << used[ch] << " " << (used[ch] < tm) << " ";
                if (used[ch] < tm)
                {
                    used[ch] = tm;
                    g[ch] = 0;
                    mm++;
                }
                //cout << used[ch] << " ";
                g[ch]++;
                if (g[ch] == 2) mm--;
            }
            mx = max(mx, mm);
        }
        ans += mx;
    }
    cout <<fixed << setprecision(10) << (ld)ans / (ld)n;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
int n, raz = 0;
vector<vector<int> > sm(100100);
vector<int> used(100100, 0), glub(100100, 0), reb(100100, 0);

int d[30][30][6000]; // l - расстояние между буквами

signed main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int l = s.size();

    for (int i = 0; i < 27; i++) {
        for (int j = 0; j < 27; j++) {
            for (int k = 0; k < 5500; k++) {
                d[i][j][k] = 0;
            }
        }
    }

    vector<int> v(6000, 0);
    vector<int> ans1(30, 0);
    for (int i = 0; i <= l - 1; i++) {
        v[i] = s[i] - 'a';
        ans1[v[i]]++;
    }

    for (int i = 0; i <= l - 1; i++) {
        for (int j = 0; j <= l - 1; j++) {
            if (i == j)
                d[v[i]][v[i]][0] += 1;
            else if (i < j) {
                d[v[i]][v[j]][j - i] += 1;
            }
            else
                d[v[i]][v[j]][l - i + j] += 1;
        }
    }

    int ans = 0, ans2 = 0;
    int maxim1 = 0, maxim2 = 0;
    double answer = 0;

    for (int temp = 0; temp < 26; temp++) {
        maxim1 = 0;

    for (int i = 0; i <= l - 1; i++) { //расстояние
        ans = 0;
        for (int t = 0; t <= 26; t++) {
            if (d[temp][t][i] == 1)
                ans++;
        }

        maxim1 = max(maxim1, ans);

    }
    //out << maxim1 << " ";
    if (ans1[temp] != 0)
        maxim2 += maxim1;
    //cout << maxim1 << " " << maxim2 << endl;

    }
    //cout << ans1[1] << endl;

    //cout.precision(7);
    //cout << maxim << " " << l << endl;
    //cout << d[0][0][1] << endl;
   printf("%.10f", (double)maxim2 / (double)l);
    //cout << (long double)maxim / (long double)l;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
int n, raz = 0;
vector<vector<int> > sm(100100);
vector<int> used(100100, 0), glub(100100, 0), reb(100100, 0);

int d[30][30][6000]; // l - расстояние между буквами

signed main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int l = s.size();

    for (int i = 0; i < 27; i++) {
        for (int j = 0; j < 27; j++) {
            for (int k = 0; k < 5500; k++) {
                d[i][j][k] = 0;
            }
        }
    }

    vector<int> v(6000, 0);
    for (int i = 0; i < l; i++)
        v[i] = s[i] - 'a';

    for (int i = 0; i <= l - 1; i++) {
        for (int j = 0; j <= l - 1; j++) {
            if (i == j)
                d[v[i]][v[i]][0] += 1;
            else if (i < j) {
                d[v[i]][v[j]][j - i] += 1;
            }
            else
                d[v[i]][v[j]][l - i + j] += 1;
        }
    }

    vector<int> ans(l + 1, 0);
    int maxim = 0;

    for (int i = 0; i <= l - 1; i++) { //расстояние
        for (int t = 0; t <= l - 1; t++) {
            if (t + i <= l - 1) {
                if (d[v[t]][v[t + i]][i] == 1)
                    ans[i]++;
            }
            else {
                if (d[v[t]][v[t + i - l]][i] == 1)
                    ans[i]++;
            }
        }
        maxim = max(maxim, ans[i]);
    }
    cout.precision(15);
    cout << (double)maxim / (double)l;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
int n, raz = 0;
vector<vector<int> > sm(100100);
vector<int> used(100100, 0), glub(100100, 0), reb(100100, 0);

int d[30][30][6000]; // l - расстояние между буквами

signed main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int l = s.size();

    for (int i = 0; i < 27; i++) {
        for (int j = 0; j < 27; j++) {
            for (int k = 0; k < 5500; k++) {
                d[i][j][k] = 0;
            }
        }
    }

    vector<int> v(6000, 0);
    for (int i = 0; i < l; i++)
        v[i] = s[i] - 'a';

    for (int i = 0; i <= l - 1; i++) {
        for (int j = 0; j <= l - 1; j++) {
            if (i == j)
                d[v[i]][v[i]][0] += 1;
            else if (i < j) {
                d[v[i]][v[j]][j - i] += 1;
            }
            else
                d[v[i]][v[j]][l - i + j] += 1;
        }
    }

    vector<int> ans(l + 1, 0);
    int maxim = 0, ind = 0;

    for (int i = 0; i <= l - 1; i++) { //расстояние
        for (int t = 0; t <= l - 1; t++) {
            if (t + i <= l - 1) {
                if (d[v[t]][v[t + i]][i] == 1)
                    ans[i]++;
            }
            else {
                if (d[v[t]][v[t + i - l]][i] == 1)
                    ans[i]++;
            }
        }
        if (maxim < ans[i]) {
            maxim = max(maxim, ans[i]);
            ind = i;
        }
    }
    cout.precision(7);
    //cout << maxim << " " << l << endl;
    //cout << ind << " ";
    cout << (long double)maxim / (long double)l;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
int n, raz = 0;
vector<vector<int> > sm(100100);
vector<int> used(100100, 0), glub(100100, 0), reb(100100, 0);

int d[30][30][6000]; // l - расстояние между буквами

signed main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int l = s.size();

    for (int i = 0; i < 27; i++) {
        for (int j = 0; j < 27; j++) {
            for (int k = 0; k < 5500; k++) {
                d[i][j][k] = 0;
            }
        }
    }

    vector<int> v(6000, 0);
    vector<int> ans1(30, 0);
    for (int i = 0; i <= l - 1; i++) {
        v[i] = s[i] - 'a';
        ans1[v[i]]++;
    }

    for (int i = 0; i <= l - 1; i++) {
        for (int j = 0; j <= l - 1; j++) {
            if (i == j)
                d[v[i]][v[i]][0] += 1;
            else if (i < j) {
                d[v[i]][v[j]][j - i] += 1;
            }
            else
                d[v[i]][v[j]][l - i + j] += 1;
        }
    }

    int ans = 0, ans2 = 0;
    int maxim1 = 0, maxim2 = 0;
    double answer = 0;

    for (int temp = 0; temp < 26; temp++) {
        maxim1 = 0;

    for (int i = 0; i <= l - 1; i++) { //расстояние
        ans = 0;
        for (int t = 0; t <= l - 1; t++) {
            if (t + i <= l - 1) {
                if (d[v[t]][v[t + i]][i] == 1 && v[t] == temp)
                    ans++;
            }
            else {
                if (d[v[t]][v[t + i - l]][i] == 1 && v[t] == temp)
                    ans++;
            }
        }
        //if (temp == 0)
            //cout << temp << " " << ans << " " << ans1[temp] << endl;
        maxim1 = max(maxim1, ans);
        /*
        if (maxim1 * ans1[temp] < ans * maxim2) {
            maxim1 = ans;
            maxim2 = ans1[temp];
        }
        */
    }
    //out << maxim1 << " ";
    if (ans1[temp] != 0)
        maxim2 += maxim1;
    //cout << maxim1 << " " << maxim2 << endl;

    }
    //cout << ans1[1] << endl;

    //cout.precision(7);
    //cout << maxim << " " << l << endl;
    //cout << d[0][0][1] << endl;
   printf("%.10f", (double)maxim2 / (double)l);
    //cout << (long double)maxim / (long double)l;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
int n, raz = 0;
vector<vector<int> > sm(100100);
vector<int> used(100100, 0), glub(100100, 0), reb(100100, 0);

int d[30][30][6000]; // l - расстояние между буквами

signed main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int l = s.size();

    for (int i = 0; i < 27; i++) {
        for (int j = 0; j < 27; j++) {
            for (int k = 0; k < 5500; k++) {
                d[i][j][k] = 0;
            }
        }
    }

    vector<int> v(6000, 0);
    for (int i = 0; i < l; i++)
        v[i] = s[i] - 'a';

    for (int i = 0; i <= l - 1; i++) {
        for (int j = 0; j <= l - 1; j++) {
            if (i == j)
                d[v[i]][v[i]][0] += 1;
            else if (i < j) {
                d[v[i]][v[j]][j - i] += 1;
            }
            else
                d[v[i]][v[j]][l - i + j] += 1;
        }
    }

    vector<int> ans(l + 1, 0);
    int maxim = 0, ind = 0;

    for (int i = 0; i <= l - 1; i++) { //расстояние
        for (int t = 0; t <= l - 1; t++) {
            if (t + i <= l - 1) {
                if (d[v[t]][v[t + i]][i] == 1)
                    ans[i]++;
            }
            else {
                if (d[v[t]][v[t + i - l]][i] == 1)
                    ans[i]++;
            }
        }
        if (maxim < ans[i]) {
            maxim = ans[i];
            ind = i;
        }
    }
    //cout.precision(7);
    //cout << maxim << " " << l << endl;
    //cout << ind << " ";
    printf("%.10f", (double)maxim / (double)l);
    //cout << (long double)maxim / (long double)l;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
int n, raz = 0;
vector<vector<int> > sm(100100);
vector<int> used(100100, 0), glub(100100, 0), reb(100100, 0);

int d[30][30][6000]; // l - расстояние между буквами

signed main() {
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int l = s.size();

    for (int i = 0; i < 27; i++) {
        for (int j = 0; j < 27; j++) {
            for (int k = 0; k < 5500; k++) {
                d[i][j][k] = 0;
            }
        }
    }

    vector<int> v(6000, 0);
    vector<int> ans1(30, 0);
    for (int i = 0; i <= l - 1; i++) {
        v[i] = s[i] - 'a';
        ans1[v[i]]++;
    }

    for (int i = 0; i <= l - 1; i++) {
        for (int j = 0; j <= l - 1; j++) {
            if (i == j)
                d[v[i]][v[i]][0] += 1;
            else if (i < j) {
                d[v[i]][v[j]][j - i] += 1;
            }
            else
                d[v[i]][v[j]][l - i + j] += 1;
        }
    }

    int ans = 0, ans2 = 0;
    int maxim1 = 0, maxim2 = 0;
    double answer = 0;

    for (int temp = 0; temp < 26; temp++) {
        maxim1 = 0;

    for (int i = 0; i <= l - 1; i++) { //расстояние
        ans = 0;
        for (int t = 0; t <= l - 1; t++) {
            if (t + i <= l - 1) {
                if (d[v[t]][v[t + i]][i] == 1 && v[t] == temp)
                    ans++;
            }
            else {
                if (d[v[t]][v[t + i - l]][i] == 1 && v[t] == temp)
                    ans++;
            }
        }
        //if (temp == 0)
            //cout << temp << " " << ans << " " << ans1[temp] << endl;
        maxim1 = max(maxim1, ans);
        /*
        if (maxim1 * ans1[temp] < ans * maxim2) {
            maxim1 = ans;
            maxim2 = ans1[temp];
        }
        */
    }
    //out << maxim1 << " ";
    if (ans1[temp] != 0)
        maxim2 += maxim1;
    //cout << maxim1 << " " << maxim2 << endl;

    }
    //cout << ans1[1] << endl;

    //cout.precision(7);
    //cout << maxim << " " << l << endl;
    //cout << d[0][0][1] << endl;
   printf("%.10f", (double)maxim2 / (double)l);
    //cout << (long double)maxim / (long double)l;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
int n, raz = 0;
vector<vector<int> > sm(100100);
vector<int> used(100100, 0), glub(100100, 0), reb(100100, 0);

int d[30][30][6000]; // l - расстояние между буквами

signed main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int l = s.size();

    for (int i = 0; i < 27; i++) {
        for (int j = 0; j < 27; j++) {
            for (int k = 0; k < 5500; k++) {
                d[i][j][k] = 0;
            }
        }
    }

    vector<int> v(6000, 0);
    for (int i = 0; i < l; i++)
        v[i] = s[i] - 'a';

    for (int i = 0; i <= l - 1; i++) {
        for (int j = 0; j <= l - 1; j++) {
            if (i == j)
                d[v[i]][v[i]][0] += 1;
            else if (i < j) {
                d[v[i]][v[j]][j - i] += 1;
            }
            else
                d[v[i]][v[j]][l - i + j] += 1;
        }
    }

    vector<int> ans(l + 1, 0);
    int maxim = 0;

    for (int i = 0; i <= l - 2; i++) { //расстояние
        for (int t = 0; t <= l - 1; t++) {
            if (t + i <= l - 1) {
                if (d[v[t]][v[t + i]][i] == 1)
                    ans[i]++;
            }
            else {
                if (d[v[t]][v[t + i - l]][i] == 1)
                    ans[i]++;
            }
        }
        maxim = max(maxim, ans[i]);
    }
    cout.precision(15);
    cout << (double)maxim / (double)l;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ll, ll> pll;

#define F first
#define S second
#define add push_back
//#define int ll
#define sz(x) (x).size()

const ll INF = (ll)1e9 + 2018;

const int N = 5010;
int ex[26][26][N], cnt[26];

void source() {
    string s;
    cin >> s;
    int n = sz(s);
    for (int i = 0; i < n; i++) {
        cnt[s[i] - 'a']++;
        for (int j = (i + 1) % n, d = 1; j != i; j = ((j == n - 1) ? 0 : j + 1), d++) {
            ex[s[i] - 'a'][s[j] - 'a'][d]++;
        }
    }
    ld ans = 0;
    for (int c = 0; c < 26; c++) {
        if (!cnt[c]) {
            continue;
        }
        ld ver = 0;
        for (int d = 1; d < n; d++) {
            int p = 0, q = 0;
            for (int c2 = 0; c2 < 26; c2++) {
                if (ex[c][c2][d] == 1) {
                    p++;
                }
                if (ex[c][c2][d] > 1) {
                    q += ex[c][c2][d];
                }
            }
            ld cur = p / (ld)(p + q);
            ver = max(ver, cur);
        }
        //cout << ver << endl;
        ans += ver * (cnt[c] / (ld)n);
    }
    cout << fixed << setprecision(10) << ans;
}

int32_t main() {
    ios::sync_with_stdio(0);
#ifdef flaax
    freopen("input.txt", "r", stdin);
#endif
    source();
}


#include <bits/stdc++.h>

#define ll long long
#define ull long long
#define ld long double

#define f first
#define s second
#define pii pair <int, int>

#define pb push_back

using namespace std;

const int MXN = 1e6 + 228;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
const double EPS = 1e-10;

int n;
string s;
string a;

int cnt[30][6000][30];

int mx;
int res;

int ans;

int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif // ONLINE_JUDGE
    cin >> s;
    n = s.size();
    s = '%' + s;
    a.resize(n + 1);
    a[0] = '%';
    for(int i = 1; i <= n; i++){
       // cout << s << ' ';
        for(int j = 2; j <= n; j++){
            cnt[s[1] - 'a'][j][s[j] - 'a'] ++;
        }
        for(int j = 1; j < n; j++){
            a[j] = s[j + 1];
        }
        a[n] = s[1];
        s = a;
    }
    for(int i = 0; i < 26; i++){
        for(int j = 2; j <= n; j++){
            res = 0;
            for(int k = 0; k < 26; k++){
                if(cnt[i][j][k] == 1){
                    res ++;
                }
            }
            mx = max(mx, res);
        }
        ans += mx;
        mx = 0;
    }
    cout << fixed << setprecision(7) << ans * 1.0 / n;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define forn(i, s, n)  for(int i=(int)s; i<int(n); i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define pll pair<long long int, long long int>
#define pii pair<int, int>
#define pss pair<string, string>
#define ull unsigned long long int
#define lld long double
#define F first
#define S second
#define PI 3.141592653589793238
#define prec(n) fixed<<setprecision(n)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define itsval(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); itval(_it, args); }
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

void itval(istream_iterator<string> it) {}
template<typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
itval(++it, args...);
}
const ll MOD= 1e+9+7;
template <typename T>
inline void print(T x){cout<<x<<"\n";}
template <typename T>
inline void printvec(T x){for(auto a:x) cout<<a<<' '; cout<<'\n';}
// -----------------------------------------------------------------------

struct custom{
    bool operator()(const pair<pii, pii> &p1, const pair<pii, pii> &p2)const{
                return p1.S.S<p2.S.S;
        }
};

// Calculate a^b % MOD -------------------------------------------------
ll get_pow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = (res*a)%MOD;
        a = (a*a)%MOD;
        b >>= 1;
    }
    return res;
}
// ---------------------------------------------------------------------
const ll N = 2e5+10, inf=4e18;

void solve()
{
    string s;cin>>s;
    int n =s.length();
    int dp[26][26][n];
    forn(i,0,26)
    {
        forn(j,0,26)
        {
            forn(k,0,n)
            dp[i][j][k]=0;
        }
    }
    forn(i,0,n)
    {
        forn(j,0,n)
        {
            if(i!=j)
            {
                dp[s[i]-'a'][s[j]-'a'][(j-i+n)%n]++;
            }
        }
    }
    int ans=0;
    forn(i,0,26)
    {
        int res=0;
        forn(j,1,n)
        {
            int z=0;
            forn(k,0,26){
                z+=int(dp[i][k][j]==1);
            }
            res=max(res, z);
        }
        ans+=res;
    }
    cout<<prec(10)<<double(ans)/double(n)<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test=1;
 //   cin>>test;
    clock_t z=clock();
    forn(tes, 0, test)
    {
        solve();
    }
    debug("Total Time:%.4f\n",(double)(clock()-z)/CLOCKS_PER_SEC);
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <iomanip>
#include <cassert>

#define endl "\n"
#define mp make_pair
#define pii pair<int, int>

typedef long long LL;

const int N = (int)1e5 + 7;

using namespace std;

template <typename T>
T sqr(T x) {
	return x * x;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
#endif
	string s; cin >> s;
	int n = (int)s.size();
	vector <int> in[26];
	for (int i = 0; i < n; i++) {
		in[s[i] - 'a'].push_back(i);
	}
	int good[26] = {};
	for (int i = 0; i < 26; i++) {
		for (int j = 1; j < n; j++) {
			int cnt[26] = {};
			for (int k = 0; k < (int)in[i].size(); k++)
				cnt[s[(in[i][k] + j) % n] - 'a']++;
			int val = 0;
			for (int k = 0; k < (int)in[i].size(); k++)
				if (cnt[s[(in[i][k] + j) % n] - 'a'] == 1)
					val++;
			good[i] = max(good[i], val);
		}
	}
	int cnt = 0;
	for (int i = 0; i < 26; i++)
		cnt += good[i];
	long double ans = (cnt + .0) / (n + .0);
	cout << fixed << setprecision(20) << ans;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;

string sft[5000];
int mask[26];
int main()
{
	string s;
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; ++i)
	{
		sft[i] = s;
		char c = s[0];
		s.erase(0, 1);
		s.push_back(c);
	}
	sort(sft, sft + n);
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		int j = i;
		while (j < n && sft[i][0] == sft[j][0]) ++j;
		int cur = 0;
		for (int k = 0; k < n; ++k)
		{
			fill(mask, mask + 26, 0);
			for (int l = i; l < j; ++l)
				++mask[sft[l][k] - 'a'];
			cur = max(cur, count(mask, mask + 26, 1));
		}
		ans += cur;
		i = j - 1;
	}
	cout << setprecision(12) << ans * 1. / n;
}


#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("Ofast")

#define _CRT_SECURE_NO_WARNINGS
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <functional>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <climits>
#include <cassert>

using namespace std;

const int MAXMEM = 1e8;
int mpos = 0;
char mem[MAXMEM];
inline void operator delete(void *) {}
inline void* operator new(size_t n) {
	char *res = mem + mpos;
	mpos += n;
	return (void *)res;
}

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <class T>
istream& operator>> (istream &is, vector<T> &v)
{
	for (int i = 0; i < v.size(); i++)
		is >> v[i];
	return is;
}

template <class T>
ostream& operator<< (ostream &os, vector<T> v)
{
	for (int i = 0; i < v.size(); i++)
		os << v[i] << ' ';
	os << '\n';
	return os;
}

#define Fi first
#define Se second
#define all(a) a.begin(),(a).end()
#define mp make_pair
#define pb push_back
#define forn(i, a, b) for (int i = a; i < b; i++)
#define downforn(i, a, b) for (int i = a; i > b; i--)
#define endl '\n'
#define np nullptr
#define ULL unsigned long long

const int ALPH = (int)('z' - 'a' + 1);

signed main() {
	//freopen("input.txt", "r", stdin);
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	string s;
	cin >> s;
	int n = s.size();
	s += s;
	vector<vector<vector<int>>> data(ALPH, vector<vector<int>>(ALPH, vector<int>(s.size(), 0)));
	vector<int> am(ALPH, 0);

	forn(i, 0, n) {
		forn(dist, 1, n) {
			data[s[i] - 'a'][s[i + dist] - 'a'][dist]++;
		}
		am[s[i] - 'a']++;
	}

	LD ans = 0;

	forn(i, 0, n) {
		LD mult = (LD)1 / n;
		LD best_add = -1;

		forn(dist, 1, n) {
			int cur_ans = 0;
			for (char c = 'a'; c <= 'z'; c++)
				if (data[s[i] - 'a'][c - 'a'][dist] == 1)
					cur_ans++;

			if (best_add < (LD)cur_ans / am[s[i] - 'a']) {
				best_add = (LD)cur_ans / am[s[i] - 'a'];
			}
		}
		ans += mult * best_add;
	}

	cout << fixed << setprecision(8) << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define null NULL
#define ld long double
#define left left228
#define right right228
#define index index228
#define prev prev228

inline void chkmax(int &x, int y) {
	if (y > x) x = y;
}

inline void chkmin(int &x, int y) {
	if (y < x) x = y;
}

inline int code(char c) {
	return c - 'a';
}

int cnt[5007][27][27];

signed main() {
	// ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = (int)s.size();
	s += s;
	for (int i = 0; i < n; ++i) {
		for (int j = 1; j < n; ++j) {
			++cnt[j][code(s[i])][code(s[i + j])];
		}
	}
	double res = 0.0;
	for (int pos = 1; pos < n; ++pos) {
		double now = 0.0;
		for (int k = 0; k < n; ++k) {
			//double cur = 1.0 / cnt[pos][code(s[k])][code(s[(k + pos) % n])];
			if (cnt[pos][code(s[k])][code(s[k + pos])] == 1) {
                now += 1.0;
			}
		}
		now /= (double)n;
		if (now > res) {
			res = now;
		}
	}
	cout << setprecision(15) << res << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define null NULL
#define ld long double
#define left left228
#define right right228
#define index index228
#define prev prev228

inline void chkmax(int &x, int y) {
	if (y > x) x = y;
}

inline void chkmin(int &x, int y) {
	if (y < x) x = y;
}

inline int code(char c) {
	return c - 'a';
}

int cnt[5007][27][27];

signed main() {
	// ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = (int)s.size();
	s += s;
	for (int i = 0; i < n; ++i) {
		for (int j = 1; j < n; ++j) {
			++cnt[j][code(s[i])][code(s[i + j])];
		}
	}
	long double res = 0.0;
	for (int pos = 1; pos < n; ++pos) {
		long double now = 0.0;
		for (int k = 0; k < n; ++k) {
			//double cur = 1.0 / cnt[pos][code(s[k])][code(s[(k + pos) % n])];
			if (cnt[pos][code(s[k])][code(s[k + pos])] == 1) {
                now += 1.000000000000;
			}
		}
		now /= (long double)n;
		if (now > res) {
			res = now;
		}
	}
	cout << setprecision(20) << res << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define null NULL
#define ld long double
#define left left228
#define right right228
#define index index228
#define prev prev228

inline void chkmax(int &x, int y) {
	if (y > x) x = y;
}

inline void chkmin(int &x, int y) {
	if (y < x) x = y;
}

inline int code(char c) {
	return c - 'a';
}

int cnt[5007][27][27];

bool used[30];

vector<int> poses[30];

signed main() {
	// ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = (int)s.size();
	s += s;
	for (int i = 0; i < n; ++i) {
		for (int j = 1; j < n; ++j) {
			++cnt[j][code(s[i])][code(s[i + j])];
		}
	}
	for (int i = 0; i < n; ++i) {
        used[code(s[i])] = true;
        poses[code(s[i])].push_back(i);
	}
	vector<int> letters;
	for (int i = 0; i < 26; ++i) {
        if (used[i]) {
            letters.push_back(i);
        }
	}
	long double res = 0.0;
	for (int let : letters) {
	    double NOW = 0.0;
        for (int pos = 1; pos < n; ++pos) {
            double now = 0.0;
            for (int k : poses[let]) {
                if (cnt[pos][code(s[k])][code(s[k + pos])] == 1) {
                    ++now;
                }
            }
            now /= (double)poses[let].size();
            if (now > NOW) {
                NOW = now;
            }
        }
        res += NOW * (double)poses[let].size() / (double)n;
	}
	cout << setprecision(20) << res << "\n";
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;

typedef long double ld;

const int SZ_OF_ALPHA = 30;
const int SZ = 5e3 + 10;

vector<int> vect[SZ_OF_ALPHA];

ld res = 0;

map<char, int> mp;

string s;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> s;
    for (int i = 0; i < s.size(); i++)
        vect[s[i] - 'a'].push_back(i);
    for (int h = 0; h <= 'z' - 'a'; h++) {
        ld now = (ld)s.size();
        for (int len = 0; len < s.size(); len++) {
            mp.clear();
            for (int ind : vect[h])
                mp[s[(ind + len) % (int)s.size()]]++;
            ld ans_now = 0;
            for (auto p : mp) {
                if (p.second > 1)
                    ans_now += p.second;
            }
            now = min(now, ans_now);
        }
        res += now;
    }
    res = (ld)(s.size()) - res;
    res /= (ld)(s.size());
    cout << fixed << setprecision(30) << res;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    vector<vector<int> >positions(30);
    string A;
    cin >> A;
    for (int i=0;i<A.size();i++){
        positions[A[i]-'a'].push_back(i);
    }
    int letras=0;
    for (int i=0;i<30;i++){
        int best=0;
        for (int j=1;j<A.size();j++){
            vector<int>V(30, 0);
            int neww=0;
            for (int k=0;k<positions[i].size();k++){
                V[A[(positions[i][k]+j)%(int)A.size()]-'a']++;
            }
            for (int k=0;k<30;k++){
                if (V[k]==1)
                    neww++;
            }
            best=max(best, neww);
        }
        letras+=best;
    }
    cout << setprecision(8) << fixed << (long double)letras/(long double)A.size() << "\n";
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

const int N = 1e5+5;
const ll inf = 2e18;

string s;
vector<string> start[30];
int pos[26];
int can[N];
signed main()
{
    cin >> s;
    int n = s.size();
    if (n == 1)
    {
        cout << 1.00000000000;
        return 0;
    }
    for (int i = 0; i < n; i++)
    {
        start[s[0]-'a'].pb(s);
        char t = s[0];
        for (int i = 0; i < int(s.size())-1; i++)
            s[i] = s[i+1];
        s[s.size()-1] = t;
    }
    for (int st = 0; st < 26; st++)
    if (start[st].size() != 0)
    {
        can[st] = 0;
        for (int num = 1; num < int(s.size()); num++)
        {
            int an = 0;
            for (int i = 0; i < 26; i++)
                    pos[i] = 0;
            for (int j = 0; j < int(start[st].size()); j++)
                pos[start[st][j][num] - 'a']++;
            int c = 0;
            for (int i = 0; i < 26; i++)
                if (pos[i] == 1)
                    c++;//cout << i << endl;
           can[st] = max(can[st] , c);
        }
        //cout << can[st] << ' ' << st  << endl;
    }
    double ans = 0;
    for (int st = 0; st < 26; st++)
        if (start[st].size()!=0)
        ans += start[st].size()*1.0/n*can[st]*1.0/start[st].size();
    cout << fixed << setprecision(6) << ans;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int ll
#define mp make_pair
const int maxinput=100005;
int inf=1e9+7;
#define pii pair <int,int>
#define sz(var) (int)var.size()
int hell=1e9+7;
signed main()
{
    FAST
    string x;cin>>x;
    int n=x.length();
    vector <int> adj[26];
    for(int i=0;i<n;i++)
        adj[x[i]-'a'].push_back(i);
    int dp[26][n+1][26]; //dp i,j,k is number of times of distance of character i, (a is character 0,z is 25) from charcter k is j ,when character k is to the right of character i in circular way
    memset(dp,0,sizeof(dp));
    for(int i=0;i<26;i++)
    {
        if(sz(adj[i])!=0)
        {
            for(int d=1;d<n;d++)
            {
                for(int j=0;j<sz(adj[i]);j++)
                {
                    int idx=adj[i][j];
                    dp[i][d][(x[(idx+d)%n]-'a')]++;
                }
            }
        }
    }

    double ans=0.00;
    for(int i=0;i<26;i++)
    {
        if(sz(adj[i]))
        {
            double maxi=0;
            //cout<<"\n-->"<<char('a'+i)<<"<--\n";
            //int uniq=0;int tot=0;
            for(int j=1;j<n;j++)
            {
                int uniq=0;int tot=0;
                //cout<<j<<":-> ";
                for(int k=0;k<26;k++)
                {
                    if(dp[i][j][k]!=0)
                    {
                        //cout<<char('a'+k)<<": ";
                        //cout<<dp[i][j][k]<<"   ";
                        if(dp[i][j][k]==1)
                            uniq++;

                        tot+=dp[i][j][k];
                    }
                }
                maxi=max(maxi,((double(uniq))/tot));
                //cout<<endl;
            }
            ans+=(maxi*sz(adj[i]))/n;
        }
    }
    cout<<setprecision(12);
    cout<<ans<<endl;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define str string
#define v vector
#define vint v<int>
#define vstr v<str>
#define vbool v<bool>
#define hset unordered_set
#define get cin>>
#define put cout<<
#define hmap unordered_map
using namespace std;

int main(){ios::sync_with_stdio(0);cin.tie(0);
    str s="";get s;//for (int i=0;i<5000;i++)s+="a";
    int n=s.length();
    bool z[26][n-1][26],forb[26][n-1][26];
    for (int i=0;i<26;i++)for(int j=0;j<n-1;j++)for(int k=0;k<26;k++){z[i][j][k]=0;forb[i][j][k]=0;}
    for (int i=0;i<n;i++){
        str t="";
        for (int j=(i+1)%n;j!=i;j=(j+1)%n){
            int p=j-(i+1)%n+(j<((i+1)%n)?n:0);
            int first=s[i]-'a',sc=s[j]-'a';
            if (z[first][p][sc]){
                z[first][p][sc]=0;
                forb[first][p][sc]=1;
            } else if (!forb[first][p][sc])z[first][p][sc]=1;
        }
    }
    ld ans=0;
    for (int i=0;i<26;i++){
        int mx=0;
        for (int j=0;j<n-1;j++)
        {
            int d=0;
            for (int k=0;k<26;k++)d+=z[i][j][k];
            mx=max(mx,d);
        }
        ans+=mx;
    }
    put setprecision(8)<<ans/(ld)n;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define str string
#define v vector
#define vint v<int>
#define vstr v<str>
#define vbool v<bool>
#define hset unordered_set
#define get cin>>
#define put cout<<
#define hmap unordered_map
using namespace std;

int main(){ios::sync_with_stdio(0);cin.tie(0);
    str s="";get s;//for (int i=0;i<5000;i++)s+="a";
    int n=s.length();
    hset<char>z[26][n-1],forb[26][n-1];
    for (int i=0;i<n;i++){
        str t="";
        for (int j=(i+1)%n;j!=i;j=(j+1)%n){
            int p=j-(i+1)%n+(j<((i+1)%n)?n:0);
            int first=s[i]-'a';
            if (z[first][p].count(s[j])){
                z[first][p].erase(s[j]);
                forb[first][p].insert(s[j]);
            } else if (!forb[first][p].count(s[j]))z[first][p].insert(s[j]);
        }
    }
    ld ans=0;
    for (int i=0;i<26;i++){
        int mx=0;
        for (int j=0;j<n-1;j++){
            mx=max(mx,(int)z[i][j].size());
        }
        ans+=mx;
    }
    put setprecision(8)<<ans/(ld)n;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define str string
#define v vector
#define vint v<int>
#define vstr v<str>
#define vbool v<bool>
#define hset unordered_set
#define get cin>>
#define put cout<<
#define hmap unordered_map
using namespace std;

int main(){ios::sync_with_stdio(0);cin.tie(0);
    str s="";//for (int i=0;i<5000;i++)s+="a";
    int n=s.length();
    hset<char>z[26][n-1],forb[26][n-1];
    for (int i=0;i<n;i++){
        str t="";
        for (int j=(i+1)%n;j!=i;j=(j+1)%n){
            int p=j-(i+1)%n+(j<((i+1)%n)?n:0);
            int first=s[i]-'a';
            if (z[first][p].count(s[j])){
                z[first][p].erase(s[j]);
                forb[first][p].insert(s[j]);
            } else if (!forb[first][p].count(s[j]))z[first][p].insert(s[j]);
        }
    }
    ld ans=0;
    for (int i=0;i<26;i++){
        int mx=0;
        for (int j=0;j<n-1;j++){
            mx=max(mx,(int)z[i][j].size());
        }
        ans+=mx;
    }
    put setprecision(8)<<ans/(ld)n;
    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE

#pragma warning(disable:4996)
//#pragma comment(linker, "/STACK:512000000")

//190647WR

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <functional>
#include <iterator>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <string>

#define ISO11
#define myDEBUG

#ifdef ISO11
#include <unordered_map>
#include <unordered_set>
#endif

#ifdef myDEBUG

#define assert(x) \
	if(!x){\
		cerr<<"\n\nERROR!\tFailed: "<<x;\
		cerr<<"\nLine: "<<__LINE__;\
		cerr<<"\nFile: "<<__FILE__;\
		cerr<<"\nTime: "<<__TIME__;\
		cerr<<"\nDate: "<<__DATE__;\
	}\

#define err(x) assert(x)
#define warn(x) assert(x)

#endif

#define F first
#define S second
#define read(x) scanf("%d", &x);
#define readln(x) scanf("%d\n", &x);
#define write(x) printf("%d ", x);
#define writeln(x) printf("%d\n", x);
#define MEM(x, y) memset(x, y, sizeof(x));
#define forn(i, n) for(int i = 0; i < n; ++i)
#define mp make_pair
#define pb push_back
#define is insert
#define runtime clock() * 1.0 / CLOCKS_PER_SEC
#define pii pair<int, int>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll INF = (1ll << 63) - 1ll;
const ld INFd = 28e14;
const ll inf = (1 << 31) - 1;
const ld EPS = 1e-8;

const ld PI = acos(-1.0);

using namespace std;

//#include <chrono>
//using namespace std::chrono;
//cerr << "Nanosec:" << duration_cast<nanoseconds>(end_time - start_time).count() << endl;
//time_point<steady_clock> start_time, end_time;
//start_time = high_resolution_clock::now();
//end_time = high_resolution_clock::now();

void OUT(bool f) { if (f) cout << "YES" << endl; else cout << "NO" << endl; }
void Out(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; }
void out(bool f) { if (f) cout << "yes" << endl; else cout << "no" << endl; }

inline int next_rand() { return abs(rand() * rand() + rand()); }

#ifdef GEOM
typedef double T;
const T eps = 1e-10;
bool equal(T a, T b) { return fabs(a - b) < eps; }
T sqr(T arg) { return arg * arg; }
struct PV {
	T x, y;
	PV() { x = y = 0; }
	PV(T x, T y) :x(x), y(y) { ; }
	PV(const PV& a, const PV& b) :x(a.x - b.x), y(a.y - b.y) { ; }
	PV turn_conrt_clock() { PV ans; ans.x = -y; ans.y = x; return ans; }
	PV turn_on_clock() { PV ans; ans.x = y; ans.y = -x; return ans; }
	PV setlen(T s = 1) { PV ans; ans.x = x; ans.y = y; s /= sqrt(x * x + y * y); ans.x *= s; ans.y *= s; return ans; }
	T len() { return sqrt(sqr(x) + sqr(y)); }
};

PV operator+ (PV lhs, const PV& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; }
PV operator- (PV lhs, const PV& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; }
T operator% (const PV& lhs, const PV& rhs) { return lhs.x * rhs.x + lhs.y * rhs.y; }
T operator* (const PV& lhs, const PV& rhs) { return lhs.x * rhs.y - lhs.y * rhs.x; }
T Po(const PV& lhs, const PV& rhs) { return sqrt(sqr(lhs.x - rhs.x) + sqr(lhs.y - rhs.y)); }
struct Line {
	T a, b, c;
	Line() { a = b = c = 0; }
	void set(PV A, PV B, bool iCV = true) {
		if (iCV)
			B = B + A;
		a = A.y - B.y;
		b = -(A.x - B.x);
		c = -B.x * a + B.y * -b;
	}
	Line(PV A, PV B, bool iCV = true) {
		set(A, B, iCV);
		//if (!equal(a, 0))
		//	multC(1.0 / a);
		//if (!equal(b, 0))
		//	multC(1.0 / b);
	}
	void multC(T s = 1) { a *= s; b *= s; c *= s; }
	PV rp() {
		PV ans;
		if (equal(a, 0)) {
			ans.y = -c / b;
			ans.x = 0;
		}
		else {
			ans.y = 0;
			ans.x = (-c) / a;
		}
		return ans;
	}
};

bool operator< (pair<T, bool> lhs, pair<T, bool> rhs) {
	if (equal(lhs.F, rhs.F)) {
		return lhs.second < rhs.second;
	}
	else
		return lhs.F < rhs.F;
}

T operator^(Line lhs, PV rhs) {
	T ans = 0;
	ans = lhs.a * rhs.x + lhs.b * rhs.y + lhs.c;
	ans /= sqrt(sqr(lhs.a) + sqr(lhs.b));
	if (lhs.c > 0)
		ans = -ans;
	return ans;
}
#endif

struct __debug__ {
	__debug__(string filename, bool f = false) {
#ifdef _DEBUG
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
#endif
		if (filename == "") return;
		ios_base::sync_with_stdio(0);
		cin.tie(0);
		cout.tie(0);
		string filein = filename + ".in";
		string fileout = filename + ".out";
		freopen(filein.c_str(), "r", stdin);
		freopen(fileout.c_str(), "w", stdout);
#ifdef _DEBUG
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
#endif
	}
	~__debug__() {
#ifdef _DEBUG
		freopen("CON", "r", stdin);
		freopen("CON", "w", stdout);
		cerr << "\n\nTIME: \t" << runtime << endl;
		system("pause");
#endif
	}
};

__debug__ DEBUG("");

//#define STRESS
void gen();
void solve();

//#define GEOM

int main() {
	srand('M' + 'A' + 'S' + 'L' + '0' + 'F');
#ifdef STRESS
	gen();
#endif
	/// zahijoja
	/// aawnrjn6
	/// fml31-p08
	/// shop-3
	/// yedetayiro
	/// afesivuda
	/// ivisuzedu
	/// ugesetacuz

	///zhsh2018user318
	///fj=pJFqz

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}
///http://tk2018.contest.codeforces.com

int cntlet[27][27][5001];
int cnts[27][27];
void solve() {
	double ans = 0;
	int n;
	string h;
	string t;
	cin >> h;
	n = h.size();
	t = h + h;
	for (int i = 0; i < n; ++i)
		for (int j = 1; j < n; ++j)
			cntlet[t[i] - 'a'][t[i + j] - 'a'][j] += 1, cnts[t[i] - 'a'][t[i + j] - 'a'] += 1;
	/*for (int i = 0; i < n; ++i) {
		t = h.substr(i) + h.substr(0, i);
		double chans = 0;
		for (int j = 0; j < 26; ++j) {
			int wins = 0;
			int kols = 0;
			if (cnts[t[0] - 'a'][j] == 1) {
				for (int x = 1; x < n; ++x)
					if (j + 'a' == t[x]) {
						kols += 1;
						wins += cntlet[t[0] - 'a'][j][x] == 1;
					}
			}
			if (kols > 0)
				chans = max(chans, 1.0 * wins / kols);
		}
		ans += chans;
	}*/
	for (int i = 0; i < 26; ++i) {
		double chans = 0;
		for (int x = 1; x < n; ++x) {
			int cnts = 0;
			for (int j = 0; j < 26; ++j)
				cnts += 1 == cntlet[i][j][x];
			chans = max(chans, 1.0 * cnts / n);
		}
		ans += chans;
	}
	cout << fixed << setprecision(12) << ans << endl;

}


#include <bits/stdc++.h>
using namespace std;

struct mine
{
    char a = 0, b = 0;
    int d = 0;
    mine(char a = 0, char b = 0, int d = 0) : a(a), b(b), d(d) {}
    friend bool operator<(const mine &a, const mine &b)
    {
        if(a.a == b.a)
        {
            if(a.b == b.b)
                return a.d < b.d;
            return a.b < b.b;
        }
        return a.a < b.a;
    }
};

int main()
{
    string s; cin >> s;
    map<mine, int> m;
    int n = s.length();
    for(int i = 0; i < n; i++)
    {
        for(int j = (i + 1) % n, k = 1; j != i; j = (j + 1) % n, k++)
            m[mine(s[i], s[j], k)]++;
    }
    vector<vector<int> > l(26, vector<int>(n + 1));
    for(int i = 0; i < n; i++)
    {
        for(int j = (i + 1) % n, k = 1; j != i; j = (j + 1) % n, k++)
            if(m[mine(s[i], s[j], k)] == 1)
                l[s[i] - 'a'][k]++;
    }
    int can = 0;
    for(int i = 0; i < 26; i++)
    {
        int cur = 0;
        for(int j = 0; j < l[i].size(); j++)
        {
            cur = max(cur, l[i][j]);
        }
        can += cur;
    }
    cout << fixed << setprecision(20) << 1.0 * can / n;
}


#include <bits/stdc++.h>
using namespace std;

struct mine
{
    char a = 0, b = 0;
    int d = 0;
    mine(char a = 0, char b = 0, int d = 0) : a(a), b(b), d(d) {}
    friend bool operator<(const mine &a, const mine &b)
    {
        if(a.a == b.a)
        {
            if(a.b == b.b)
                return a.d < b.d;
            return a.b < b.b;
        }
        return a.a < b.a;
    }
};

int main()
{
    string s; cin >> s;
    map<mine, int> m;
    int n = s.length();
    for(int i = 0; i < n; i++)
    {
        for(int j = (i + 1) % n, k = 1; j != i; j = (j + 1) % n, k++)
            m[mine(s[i], s[j], k)]++;
    }
    /*for(int len = 1; len <= n; len++)
    {
        cout << len << ": ";
        for(char i = 'a'; i <= 'z'; i++)
            for(char j ='a'; j <= 'z'; j++)
                if(m[mine(i, j, len)] == 1)
                    cout << "(" << i << ", " << j << ") ";
        cout << endl;
    }*/
    /*for(int len = 1; len <= n; len++)
    {
        double cur = 0;
        for(int i = 0; i < n; i++)
            for(char j = 'a'; j <= 'z'; j++)
                if(m[mine(s[i], j, len)] == 1)
                {
                    cur++;
                    cout << i << " " << j << "   ";
                    break;
                }
        cout << endl;
        can = max(can, cur);
    }*/
    vector<int> l(n + 1);
    for(int i = 0; i < n; i++)
    {
        for(int j = (i + 1) % n, k = 1; j != i; j = (j + 1) % n, k++)
            if(m[mine(s[i], s[j], k)] == 1)
                l[k]++;
    }
    int can = 0;
    for(int i = 0; i < l.size(); i++)
        can = max(can, l[i]);
    cout << fixed << setprecision(20) << 1.0 * can / n;
}


#include <bits/stdc++.h>
using namespace std;

struct mine
{
    char a = 0, b = 0;
    int d = 0;
    mine(char a = 0, char b = 0, int d = 0) : a(a), b(b), d(d) {}
    friend bool operator<(const mine &a, const mine &b)
    {
        if(a.a == b.a)
        {
            if(a.b == b.b)
                return a.d < b.d;
            return a.b < b.b;
        }
        return a.a < b.a;
    }
};

int main()
{
    string s; cin >> s;
    int n = s.length();
    vector<vector<vector<int> > > m(26, vector<vector<int> >(26, vector<int>(n + 1)));
    for(int i = 0; i < n; i++)
    {
        for(int j = (i + 1) % n, k = 1; j != i; j = (j + 1) % n, k++)
            m[s[i] - 'a'][s[j] - 'a'][k]++;
    }
    vector<vector<int> > l(26, vector<int>(n + 1));
    for(int i = 0; i < n; i++)
    {
        for(int j = (i + 1) % n, k = 1; j != i; j = (j + 1) % n, k++)
            if(m[s[i] - 'a'][s[j] - 'a'][k] == 1)
                l[s[i] - 'a'][k]++;
    }
    int can = 0;
    for(int i = 0; i < 26; i++)
    {
        int cur = 0;
        for(int j = 0; j < l[i].size(); j++)
        {
            cur = max(cur, l[i][j]);
        }
        can += cur;
    }
    cout << fixed << setprecision(20) << 1.0 * can / n;
}


#include <bits/stdc++.h>
#define F(i,n) for (int i=0;i<(int)n;i++)
using namespace std;
using ll=long long;

int f[26][5000][26],k[26];

int main() {
	ios_base::sync_with_stdio(0);
	string s; cin>>s; int n=s.size();
	memset(f,0,sizeof(f));
	memset(k,0,sizeof(k));
	F(i,n) k[s[i]-'a']++;
	F(i,n) F(j,n) f[s[i]-'a'][j][s[(i+j)%n]-'a']++;
	int prob=0;
	F(i,26) if (k[i]) {
		int t=0;
		F(j,n) {
			int kk=0;
			F(ii,26) if (f[i][j][ii]==1) kk++;
			t=max(t,kk);
		}
		prob+=t;
	}
	cout<<fixed<<setprecision(10)<<double(prob)/n;
	return 0;
}


#include <iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<cstring>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    double ans = 0;
    vector< vector<string> > st(26, vector<string>());
    string cur = "";
    for(int i=0 ;i<n; i++){
        st[s[i] - 'a'].push_back(s.substr(i, n) + cur);
        cur.push_back(s[i]);
    }
    //for(int i=0; i<st.size(); i++){
      //  for(int j = 0; j<st[i].size(); j++){
       //     cout << st[i][j] << endl;
        //}
    //}

    for(int i=0; i<st.size(); i++){
        vector<int> check;
        int mx = 0;
        for(int j = 1; j<n; j++){
            check.assign(26, 0);
            for(int p = 0; p<st[i].size(); p++){
                check[st[i][p][j] -'a']++;
            }
            int x = 0;
            for(int  p =0; p<26; p++){
                if(check[p]==1)
                    x++;
            }
            mx = max(mx, x);
        }
        ans += mx;
    }
    ans /= n;
    cout.precision(20);
    cout << ans;
    return 0;
}


#include <iostream>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdio>
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int next() {int x; cin >> x; return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cout.precision(15);
    string s;
    cin >> s;
    string sc = s;
    string ss[s.length()];
    ss[0] = s;
    int n = s.length();
    map <char, int> kol;
    for (int i = 1; i < n; i++) {
        char c = s[n - 1];
        s.erase(n-1);
        s = c + s;
        ss[i] = s;
    }
    s = sc;
    for (int i = 0; i < n; i++) {
        kol[s[i]]++;
    }
    double ans = 0;
    for (int i = 0; i < 30; i++) {
        if(kol[i + 'a'] == 0) continue;
        double p1 = (kol[i + 'a'] * 1.0) / n;
        int koll = 0;
        for (int j = 0; j < n; j++) if(ss[j][0] == i + 'a') koll++;
        vector <int> use;
        for (int j = 0; j < n; j++) if(ss[j][0] == i + 'a') use.push_back(j);
        double maxx = 0;
        for (int j = 1; j < n; j++) {
            map<char, int> bukv;
            double raz = 0;
            for (int x : use) {
                bukv[ss[x][j]]++;
            }
            for (auto a : bukv) {
                raz += (1.0 / a.second) * (a.second /  koll);
            }
            //cout << raz << " " << l << " " << koll << endl;
            if(raz > maxx) maxx = raz;
        }
        //cout << maxx << " " << koll << " " << p1 << endl;
        ans += p1 * maxx * 1.0;
    }
    cout << ans;
}


#include <iostream>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdio>
#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int next() {int x; cin >> x; return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cout.precision(15);
    string s;
    cin >> s;
    string sc = s;
    string ss[s.length()];
    ss[0] = s;
    int n = s.length();
    map <char, int> kol;
    for (int i = 1; i < n; i++) {
        char c = s[n - 1];
        s.erase(n-1);
        s = c + s;
        ss[i] = s;
    }
    s = sc;
    for (int i = 0; i < n; i++) {
        kol[s[i]]++;
    }
    double ans = 0;
    for (int i = 0; i < 30; i++) {
        if(kol[i + 'a'] == 0) continue;
        double p1 = (kol[i + 'a'] * 1.0) / n;
        int koll = 0;
        for (int j = 0; j < n; j++) if(ss[j][0] == i + 'a') koll++;
        vector <int> use;
        for (int j = 0; j < n; j++) if(ss[j][0] == i + 'a') use.push_back(j);
        bool flag = false;
        int maxx = 0;
        for (int j = 1; j < n; j++) {
            map<char, int> bukv;
            double raz = 0;
            for (int x : use) {
                bukv[ss[x][j]]++;
            }
            for (auto x : bukv) {
                if(x.second == 1) raz++;
            }
            if(raz > maxx) maxx = raz;
        }
        //cout << maxx << " " << koll << " " << p1 << endl;
        ans += p1 * (maxx * 1.0) / koll;
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

#define FILE ""
#define F first
#define S second

int main()
{
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //freopen(FILE".txt", "r", stdin);
    //freopen(FILE".txt", "w", stdout);
#endif // LOCAL
    string s;
    cin >> s;
    int n = s.size();
    vector <int> cnt(300, 0);
    vector<vector<vector<int> > > k(30, vector<vector<int> >(n + 1, vector<int>(30, 0)));
    for (int i = 0; i < n; ++i)
    {
        cnt[s[i] - 'a']++;
        for (int j = 0; j < n; ++j)
        {
            int l = 0;
            if (j >= i) l = j - i;
            else
                l = j + n - i;
            k[s[i] - 'a'][l][s[j] - 'a']++;
        }
    }
    long long ans = 0;
    for (int i = 0; i <= 'z' - 'a'; ++i)
    {
        if (cnt[i] == 0) continue;
        if (cnt[i] == 1)
        {
            ans++;
            continue;
        }
        int mx = 0;
        for (int j = 1; j < n; ++j)
        {
            int cur = 0;
            for (int c = 0; c <= 'z' - 'a'; ++c)
                if (k[i][j][c] == 1) cur++;
            mx = max(mx, cur);
        }
        ans += mx;
    }
    cout << fixed << setprecision(16) << (long double)1.0 * ans / n;
    return 0;
}


#include <stdio.h>
#include <unordered_map>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>

using namespace std;

string s;
char ss[5500];

int dp[30][30][5500];
double cnt[30];

int main()
{
    scanf("%s", ss);
    int len = strlen(ss);
    s = string(ss);

    for (int i = 0; i < len; ++i)
    {
        int symb = s[i] - 'a';
        cnt[symb]++;
        for (int j = 1; j < len; ++j)
        {
            dp[symb][s[(i + j) % len] - 'a'][j]++;
        }
    }
    double ans = 0;
    for (int i = 0; i < 26; ++i)
    {
        if (cnt[i])
        {
            int maxi = 0;
            for (int j = 0; j < len; ++j)
            {
                int s = 0;
                for (int k = 0; k < 26; ++k)
                {
                    if (dp[i][k][j] == 1) s++;
                }
                maxi = max(maxi, s);
            }
            ans += maxi;
        }
    }
    printf("%.15f", (ans / (len * 1.0)));
    return 0;
}


#include <stdio.h>
#include <unordered_map>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <cstring>

using namespace std;

string s;
char ss[5500];

int dp[30][30][5500];
double cnt[30];

int main()
{
    scanf("%s", ss);
    int len = strlen(ss);
    s = string(ss);

    for (int i = 0; i < len; ++i)
    {
        int symb = s[i] - 'a';
        cnt[symb]++;
        for (int j = 1; j < len; ++j)
        {
            dp[symb][s[(i + j) % len] - 'a'][j]++;
        }
    }
    double ans = 0;
    for (int i = 0; i < 26; ++i)
    {
        if (cnt[i])
        {
            int maxi = 0;
            for (int j = 0; j < len; ++j)
            {
                int s = 0;
                for (int k = 0; k < 26; ++k)
                {
                    if (dp[i][k][j] == 1) s++;
                }
                maxi = max(maxi, s);
            }
            ans += maxi;
        }
    }
    printf("%.15f", (ans / (len * 1.0)));
    return 0;
}


#include <bits/stdc++.h>
//#pragma GCC optimize("O3") /*THIS*/
//#pragma GCC optimize("03")

using namespace std;

typedef long double ld;

int ind(char c) {
    return c - 'a';
}

const ld eps = 1e-9;

int main() {
    #ifdef MY
        freopen("input.txt", "r", stdin);
    #endif // MY
    cout << fixed << setprecision(7);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    deque <char> s;
    char c;
    while (cin >> c) {
        s.push_back(c);
    }
    while (!(s[int(s.size()) - 1] >= 'a' && s[int(s.size()) - 1] <= 'z')) {
        s.pop_back();
    }
    int n = int(s.size());
    vector <vector <deque <char> > > d(26);
    d[ind(s[0])].push_back(s);
    for (int i = 0; i < n - 1; ++i) {
        s.push_back(s[0]);
        s.pop_front();
        //for (auto c : s) {cout << c;} cout << "\n";
        d[ind(s[0])].push_back(s);
    }
    vector <ld> ver(26, 0);
    for (int f = 0; f < 26; ++f) {
        vector <vector <int> > used(n, vector <int> (26, 0));
        for (auto t : d[f]) {
            for (int i = 1; i < n; ++i) {
                used[i][ind(t[i])]++;
            }
        }
        ver[f] = 0;
        for (int i = 1; i < n; ++i) {
            ld cur = 0;
            ld cnt = 0;
            for (int j = 0; j < 26; ++j) {
                if (!used[i][j]) {
                    continue;
                }
                cnt += used[i][j];
                if (used[i][j] == 1) {
                    cur++;
                }
            }
            if (cnt < eps) {
                continue;
            }
            ver[f] = max(ver[f], cur / cnt);
        }
    }
    ld cnt = 0;
    for (int f = 0; f < 26; ++f) {
        if (!d[f].empty()) {
            cnt += ld(d[f].size());
        }
    }
    ld res = 0;
    for (int f = 0; f < 26; ++f) {
        if (d[f].empty()) {
            continue;
        }
        res += (ver[f] * ld(d[f].size())) / cnt;
    }
    cout << res;
    return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse4")
#ifdef LOCAL
    #define __GLIB_CXXDEBUG
#endif // LOCAL
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

#define ll long long
#define double long double
#define ld double
#define pii pair<int, int>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mat make_tuple

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

const int INF = INT_MAX / 2;
const ll M = 1e9 + 7, LINF = 2e18 + 666;
const ld EPS = 1e-12;

template<class T, class CMP = less<T>>
using ordered_set = tree<T, null_type, CMP, rb_tree_tag, tree_order_statistics_node_update>;

template<class T1, class T2>
bool mini(T1 &x, T2 y)
{
    if (x > y)
    {
        x = y;
        return 1;
    }
    return 0;
}

template<class T1, class T2>
bool maxi(T1 &x, T2 y)
{
    if (x < y)
    {
        x = y;
        return 1;
    }
    return 0;
}

void run();

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    auto start = clock();
    srand(time(0));
    cout << setprecision(15) << fixed;
    run();
    #ifdef LOCAL
        cout << "\ntime = " << (ld)(clock() - start) / CLOCKS_PER_SEC;
    #endif
    return 0;
}

#define DEBUG
#if defined DEBUG && defined LOCAL
    #define debugdo(x) x
#else
    #define debugdo(x) ;
#endif // defined

#define debug(x) debugdo(cout << x << endl);
#define debug2(x) debugdo(cout << x << " ");

// ---SOLUTION--- //

void run()
{
    string s;
    cin >> s;
    int n = s.size();
    vector<array<array<int, 26>, 26>> v(n);
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            v[i][s[j] - 'a'][s[(j + i) % n]]++;
        }
    }
    vector<int> c(26);
    for (auto x: s)
        c[x - 'a']++;
    vector<int> c1(26);
    for (int i = 0; i < 26; i++)
    {
        int best = 0;
        for (int k = 1; k < n; k++)
        {
            int res = 0;
            for (int j = 'a'; j <= 'z'; j++)
            {
                if (v[k][i][j] == 1)
                    res++;
            }
            maxi(best, res);
        }
        c1[i] = best;
    }
    int ans = 0;
    for (int i = 0; i < 26; i++)
    {
        ans += c1[i];
    }
    cout << (ld)ans / n;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse4")
#ifdef LOCAL
    #define __GLIB_CXXDEBUG
#endif // LOCAL
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

#define ll long long
#define double long double
#define ld double
#define pii pair<int, int>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mat make_tuple

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

const int INF = INT_MAX / 2;
const ll M = 1e9 + 7, LINF = 2e18 + 666;
const ld EPS = 1e-12;

template<class T, class CMP = less<T>>
using ordered_set = tree<T, null_type, CMP, rb_tree_tag, tree_order_statistics_node_update>;

template<class T1, class T2>
bool mini(T1 &x, T2 y)
{
    if (x > y)
    {
        x = y;
        return 1;
    }
    return 0;
}

template<class T1, class T2>
bool maxi(T1 &x, T2 y)
{
    if (x < y)
    {
        x = y;
        return 1;
    }
    return 0;
}

void run();

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    auto start = clock();
    srand(time(0));
    cout << setprecision(15) << fixed;
    run();
    #ifdef LOCAL
        cout << "\ntime = " << (ld)(clock() - start) / CLOCKS_PER_SEC;
    #endif
    return 0;
}

#define DEBUG
#if defined DEBUG && defined LOCAL
    #define debugdo(x) x
#else
    #define debugdo(x) ;
#endif // defined

#define debug(x) debugdo(cout << x << endl);
#define debug2(x) debugdo(cout << x << " ");

// ---SOLUTION--- //

void run()
{
    string s;
    cin >> s;
    int n = s.size();
    vector<array<array<int, 26>, 26>> v(n);
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            v[i][s[j] - 'a'][s[(j + i) % n] - 'a']++;
        }
    }
    vector<int> c(26);
    for (auto x: s)
        c[x - 'a']++;
    vector<int> c1(26);
    for (int i = 0; i < 26; i++)
    {
        int best = 0;
        for (int k = 1; k < n; k++)
        {
            int res = 0;
            for (int j = 0; j < 26; j++)
            {
                if (v[k][i][j] == 1)
                    res++;
            }
            maxi(best, res);
        }
        c1[i] = best;
    }
    int ans = 0;
    for (int i = 0; i < 26; i++)
    {
        ans += c1[i];
    }
    cout << (ld)ans / n;
}