#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <unordered_set>

using namespace std;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> int2;
const int Inf = (int)1e9+7;

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
#define mp make_pair
#define endl "\n"

namespace {

    const int N = 5007;
    int h[26][N][26];

    void solve()
    {
        string s; cin >> s;
        int n = (int)s.size();

        vector<string> T;
        for (int i = n; i > 0; i--) {
            string x = s.substr(0, i);
            string y = s.substr(i);
            T.emplace_back(y + x);
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                h[T[i][0]-'a'][j][T[i][j]-'a']++;
            }
        }

        double res = 0.0;
        for (char c = 'a'; c <= 'z'; c++) {
            if (h[c-'a'][0][c-'a'] == 0) continue;
            int cnt_max = 0;
            for (int i = 1; i < n; i++) {
                int cnt = 0; // how many position we can uniquely determine the string
                for (int j = 0; j < 26; j++)
                    cnt += h[c-'a'][i][j] == 1 ? 1 : 0;
                cnt_max = max(cnt_max, cnt);
            }
            res += 1.0 * cnt_max / n;
        }

        cout << res << endl;
    }

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(9);
    cout << fixed;

    // clock_t ts;
    // ts = clock();
    solve();
    // ts = clock()-ts;
    // cout << (ts*1000.0/CLOCKS_PER_SEC) << " ms" << endl;
    return 0;
}


//   __________________
//  | ________________ |
//  ||          ____  ||
//  ||   /\    |      ||
//  ||  /__\   |      ||
//  || /    \  |____  ||
//  ||________________||
//  |__________________|
//  \###################\
//   \###################\
//    \        ____       \
//     \_______\___\_______\
// An AC a day keeps the doctor away.

#pragma GCC optimize("Ofast")
#pragma loop_opt(on)
#include <bits/extc++.h>
#ifdef local
#define safe std::cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
#define debug(...) qqbx(#__VA_ARGS__,  __VA_ARGS__)
template <typename H, typename ...T> constexpr void qqbx(const char *s, const H &h, T &&...args) {
    for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr << *s;
    std::cerr << " = " << h << (sizeof...(T) ? ", " : "\n");
    if constexpr(sizeof...(T)) qqbx(++s, args...); // C++ 17!
}
#else
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#define safe ((void)0)
#endif // local
#define all(v) begin(v),end(v)
#define get_pos(v,x) (lower_bound(begin(v),end(v),x)-begin(v))
#define sort_uni(v) sort(begin(v),end(v)),v.erase(unique(begin(v),end(v)),end(v))
#define pb emplace_back
#define ff first
#define ss second
#define mem(v,x) memset(v,x,sizeof v)

using namespace std;
using namespace __gnu_pbds;
typedef int64_t ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
template <typename T> using max_heap = std::priority_queue<T,vector<T>,less<T> >;
template <typename T> using min_heap = std::priority_queue<T,vector<T>,greater<T> >;
template <typename T> using rbt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
constexpr ld PI = acos(-1), eps = 1e-7;
constexpr ll N = 5025, INF = 1e18, MOD = 1000000007, K = 100, inf = 1e9;
constexpr inline ll cdiv(ll x, ll m) { return x/m + ((x<0 ^ m>0) && (x%m)); } // ceiling divide
constexpr inline ll modpow(ll e,ll p,ll m=MOD) { ll r=1; for(e%=m;p;p>>=1,e=e*e%m) if(p&1) r=r*e%m; return r; }

string s;
int cnt[26][N][26];
int may[26] = {};
signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> s;
    for(int k = 0; k < s.size(); k++) {
        may[s[k]-'a'] += 1;
        for(int i = 1; i < s.size(); i++) {
            cnt[s[k]-'a'][i][s[(i+k)%s.size()]-'a'] += 1;
        }
    }
    ld ans = 0;
    for(int c = 0; c < 26; c++) {
        ld p = 0;
        for(int i = 1; i < s.size(); i++) {
            int win = 0, lose = 0;
            for(int d = 0; d < 26; d++) {
                if(cnt[c][i][d] == 1) win += 1;
                else lose += cnt[c][i][d];
            }
            p = max(p, win / ld(win+lose));
        }
        ans += p * may[c];
    }
    cout<<fixed<<setprecision(10)<<ans/int(s.size());
}


#include"bits/stdc++.h"
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ld           long double
#define vi           vector<int>
#define pii          pair<int,int>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define endl         '\n'
#define rep(i,s,e)   for(int i=(s);i<=(e);i++)
#define brep(i,s,e)  for(int i=(s);i>=(e);i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,y,sizeof(x))
#define milf(x)      x.reserve(1LL<<14LL); x.max_load_factor(0.25); // less_equal
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937              rng(chrono::steady_clock::now().time_since_epoch().count());
#define int          long long
const int INF = 0x3F3F3F3F3F3F3F3F;
const int MOD = 1e9+7;
ld EPS = 1e-12;

short rain()
{
    // int t;cin>>t;rep(test,1,t)
    {
        string s;
        cin >> s;
        int n = s.length();
        vector<int> id[26];
        rep(i,0,n-1)
            id[ s[i]-'a' ].pb( i );
        ld ans = 0;
        rep(i,0,25)
        {
            if( id[i].empty() )
                continue;
            int mx = 0;
            rep(j,0,n-1)
            {
                int unq = 0;
                map<char,int> hsh;
                for(auto &k:id[i])
                {
                    k++, k %= n;
                    hsh[ s[k] ]++;
                }
                for(auto k:hsh)
                {
                    if( k.ss == 1 )
                        unq++;
                }
                mx = max( mx, unq );
            }
            ans += (ld)(mx)/(ld)(n);
        }
        cout << ans << endl;
    }

    return 0;
}

signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // ifstream fin("ip.txt");  ofstream fout("op.txt");
    int start = 1000*clock()/CLOCKS_PER_SEC;
    cout << fixed << setprecision(15);           rain();
    cerr<<"\nRuntime: "<< 1000*clock()/CLOCKS_PER_SEC-start <<"ms\n";
}


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

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) int x; cin>>(x);
#define SIN(x) string x; cin>>(x);
#define INN(x, y) int x, y; cin>>(x)>>(y);
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define mp make_pair
#define log(x) cout<<#x<<" : "<<x<<endl;
#define logp(x) cout<<#x<<" : ("<<x.fi<<", "<<x.se<<")"<<endl;
#define logi(a, i) cout<<#a<<'['<<i<<']'<<" : "<<a[i]<<endl;
#define loga(a, n) cout<<#a<<" -> "; F(n) cout<<i<<": "<<a[i]<<", "; cout<<endl;
#define logv(a) loga(a, a.size())
#define out(x) cout<<x<<endl
#define outp(x) cout<<x.fi<<' '<<x.se<<endl
#define outa(a, n) F(n) cout<<a[i]<<' '; cout<<endl;
#define outv(a) outa(a, a.size())
#define sim template<class t
typedef long long ll;
typedef long double LD;
sim> void maxi(t &x, t y) {if(x<y) x=y;}
sim> void mini(t &x, t y) {if(x>y) x=y;}
using namespace std;

#define N 5005

string s[N], t;
int n, cnt[N][N];

void copy(int k) {
    s[k].resize(n);
    F(n) s[k][i] = t[(i+k)%n];
}

int main() {
	ios::sync_with_stdio(0);
    cout<<setprecision(10)<<fixed;
    cin>>t;
    n = t.size();
    F(n) copy(i);
    sort(s, s+n);
    /* F(n) out(s[i]); */
    int i=0;
    int ans=0;
    while(i<n) {
        int j=i;
        repi(k, 'a', 'z') FI(n-1) cnt[k][i]=0;
        while(j<n && s[j][0]==s[i][0]) {
            FI(n-1) cnt[s[j][i]][i]++;
            j++;
        }
        j--;
        int check = false;
        repi(k, 'a', 'z') {FI(n-1) if(cnt[k][i]==1) {check++; break;} if(check) break;}
        if(check) ans += 1+((j-i) == 1);
        i = j+1;
    }
    out(ans*1.0/n);
	return 0;
}


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

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) int x; cin>>(x);
#define SIN(x) string x; cin>>(x);
#define INN(x, y) int x, y; cin>>(x)>>(y);
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define mp make_pair
#define log(x) cout<<#x<<" : "<<x<<endl;
#define logp(x) cout<<#x<<" : ("<<x.fi<<", "<<x.se<<")"<<endl;
#define logi(a, i) cout<<#a<<'['<<i<<']'<<" : "<<a[i]<<endl;
#define loga(a, n) cout<<#a<<" -> "; F(n) cout<<i<<": "<<a[i]<<", "; cout<<endl;
#define logv(a) loga(a, a.size())
#define out(x) cout<<x<<endl
#define outp(x) cout<<x.fi<<' '<<x.se<<endl
#define outa(a, n) F(n) cout<<a[i]<<' '; cout<<endl;
#define outv(a) outa(a, a.size())
#define sim template<class t
typedef long long ll;
typedef long double LD;
sim> void maxi(t &x, t y) {if(x<y) x=y;}
sim> void mini(t &x, t y) {if(x>y) x=y;}
using namespace std;

#define N 5005

string s[N], t;
int n, cnt[N][N];

void copy(int k) {
    s[k].resize(n);
    F(n) s[k][i] = t[(i+k)%n];
}

int main() {
	ios::sync_with_stdio(0);
    cout<<setprecision(10)<<fixed;
    cin>>t;
    n = t.size();
    F(n) copy(i);
    sort(s, s+n);
    /* F(n) out(s[i]); */
    int i=0;
    int ans=0;
    while(i<n) {
        int j=i;
        repi(k, 'a', 'z') FI(n-1) cnt[k][i]=0;
        while(j<n && s[j][0]==s[i][0]) {
            FI(n-1) cnt[s[j][i]][i]++;
            j++;
        }
        j--;
        int check = false;
        FI(n-1) {
            int x = 0;
            repi(k, 'a', 'z') x += cnt[k][i]==1;
            maxi(check, x);
        }
        ans += check;
        i = j+1;
    }
    out(ans*1.0/n);
	return 0;
}


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

string s,r;
vector<string> V[30];
int t[30];

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

	cin >> s;
	int n=s.size(),a,maxx,su=0;

	s+=s;
	for(int i=0;i<n;i++)
	{
		r="";
		for(int j=i;j<i+n;j++) r+=s[j];

		V[int(r[0])-97].push_back(r);
	}

	for(int i=0;i<26;i++)
	{
		maxx=0;
		for(int j=1;j<n;j++)
		{
			for(int k=0;k<26;k++) t[k]=0;

			for(int k=0;k<V[i].size();k++)
			{
				t[int(V[i][k][j])-97]++;
			}

			a=0;
			for(int k=0;k<26;k++)
			{
				if(t[k]==1) a++;
			}

			if(a>maxx) maxx=a;
		}

		su+=maxx;
	}

	long double x=su,y=n;
	cout << fixed << setprecision(7) << x/y;

	return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define double long double

		   //       |----|       /\      |    |   -----   |
		   //       |   /       /  \     |    |     |     |
		   //       |--/       /----\    |----|     |     |
		   //       |   \     /      \   |    |     |     |
		   //       |    \   /        \  |    |   -----   -------

int add[26][5002][26];
int freq[26];
int32_t main()
{
	IOS;
	string s;
	cin>>s;
	int l=s.length();
    unordered_set<int> hs[26][l+1];
    for(int i=0;i<l;i++)
    {
        int t=s[i]-97;
        freq[t]++;
        for(int j=i+1;j<i+l;j++)
        {
            if(hs[t][j-i-1].find(s[j%l]-97)!=hs[t][j-i-1].end())
                hs[t][j-i-1].insert(s[j%l]-97);
            add[t][j-i-1][s[j%l]-97]++;
        }
    }
    int summ=0;
    for(int i=0;i<26;i++)
    {
        int maxi=0;
        for(int j=0;j<=l;j++)
        {
            int sum=0;
            for(int k=0;k<26;k++)
                if(add[i][j][k]<=1)
                sum+=add[i][j][k];
            maxi=max(maxi,sum);
        }
        summ+=maxi;
    }
    cout<<fixed<<setprecision(12)<<summ*1.0/l;
}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'
#define mo 998244353

using namespace std ;

#define MAXN 5000001

typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

vll occ[26];

int main()
{
////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
///////////////////////////////////////////

    string s;
    cin>>s;

    lli n = s.size() ;

    loopl(i,0,s.size())
    occ[s[i]-'a'].pb(i);

    bool mark[n] = {0};

    loopl(i,0,26)
    {
        if(occ[i].size() > 26 || occ[i].size()==0)
            continue;

        if(occ[i].size() == 1)
        {
            mark[occ[i][0]]=1;
            continue;
        }

        lli mx=-1 , in;
        loopl(j,1,n)
        {
            vll vv[26];
            for(auto x:occ[i])
            {
                lli oo = (x+j)%n;
                vv[s[oo]-'a'].pb(x);
            }

            lli cnt=0;
            loopl(oo,0,26)
            {
                if(vv[oo].size() == 1)
                    cnt++;
            }

            if(cnt > mx)
            {
                mx = cnt;
                in = j;
            }
        }

         vll vv[26];
            for(auto x:occ[i])
            {
                lli oo = (x+in)%n;
                vv[s[oo]-'a'].pb(x);
            }

            loopl(oo,0,26)
            {
                if(vv[oo].size() == 1)
                    mark[vv[oo][0]]=1;
            }
    }

    lld ans=0;
    loopl(i,0,n)
    {
       // cout<<mark[i]<<endl;
        if(mark[i]) ans = ans*1.00 + 1.00;
    }

    ans/=n*1.00;

    cout<<fixed<<setprecision(12)<<ans<<endl;

}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'
#define mo 998244353

using namespace std ;

#define MAXN 5000001

typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

vll occ[26];

int main()
{
////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
///////////////////////////////////////////

    string s;
    cin>>s;

    lli n = s.size() ;

    loopl(i,0,s.size())
    occ[s[i]-'a'].pb(i);

    bool mark[n] = {0};

    loopl(i,0,26)
    {
        if(occ[i].size() > 26 || occ[i].size()==0)
            continue;

        if(occ[i].size() == 1)
        {
            mark[occ[i][0]]=1;
            continue;
        }

        lli mx=-1 , in;
        loopl(j,1,n)
        {
            vll vv[26];
            for(auto x:occ[i])
            {
                lli oo = (x+j)%n;
                vv[s[oo]-'a'].pb(x);
            }

            lli cnt=0;
            loopl(oo,0,26)
            {
                if(vv[oo].size() == 1)
                    cnt++;
            }

            if(cnt > mx)
            {
                mx = cnt;
                in = j;
            }
        }

         vll vv[26];
            for(auto x:occ[i])
            {
                lli oo = (x+in)%n;
                vv[s[oo]-'a'].pb(x);
            }

            loopl(oo,0,26)
            {
                if(vv[oo].size() == 1)
                    mark[vv[oo][0]]=1;
            }
    }

    lld ans=0;
    loopl(i,0,n)
    {
       // cout<<mark[i]<<endl;
        if(mark[i]) ans++;
    }

    ans/=n;

    cout<<fixed<<setprecision(12)<<ans<<endl;

}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'
#define mo 998244353

using namespace std ;

#define MAXN 5000001

typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

vll occ[26];

int main()
{
////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
///////////////////////////////////////////

    string s;
    cin>>s;

    lli n = s.size() ;

    loopl(i,0,s.size())
    occ[s[i]-'a'].pb(i);

    bool mark[n] = {0};

    loopl(i,0,26)
    {
        if(occ[i].size()==0)
            continue;

        if(occ[i].size() == 1)
        {
            mark[occ[i][0]]=1;
            continue;
        }

        lli mx=-1 , in;
        loopl(j,1,n)
        {
            vll vv[26];
            for(auto x:occ[i])
            {
                lli oo = (x+j)%n;
                vv[s[oo]-'a'].pb(x);
            }

            lli cnt=0;
            loopl(oo,0,26)
            {
                if(vv[oo].size() == 1)
                    cnt++;
            }

            if(cnt > mx)
            {
                mx = cnt;
                in = j;
            }
        }

         vll vv[26];
            for(auto x:occ[i])
            {
                lli oo = (x+in)%n;
                vv[s[oo]-'a'].pb(x);
            }

            loopl(oo,0,26)
            {
                if(vv[oo].size() == 1)
                    mark[vv[oo][0]]=1;
            }
    }

    lld ans=0;
    loopl(i,0,n)
    {
       // cout<<mark[i]<<endl;
        if(mark[i]) ans = ans*1.00 + 1.00;
    }

    ans/=n*1.00;

    cout<<fixed<<setprecision(12)<<ans<<endl;

}


#include<bits/stdc++.h>
#define REP(i,j,k) for(int i=j;i<k;++i)
#define RREP(i,j,k) for(int i=(int)j-1;i>=k;--i)
#define int long long
#define pb emplace_back
#define P pair<int,int>
#define F first
#define S second
#define ALL(x) x.begin(),x.end()
#define sz(a) (int)(a).size()
#define MX 100005
#define oo 1e18
#define mid (l+r>>1)
#define L(i) l,mid,(i*2)
#define R(i) mid+1,r,(i*2+1)
#define MIN(x,y) (x=min(x,(y)))
#define MAX(x,y) (x=max(x,(y)))
#define mo (int)(1e9+7)
#define IOS cin.tie(0) ,cout.tie(0), cout.sync_with_stdio(0)
using namespace std;
int ans,ma,cnt;
string s;
map<int,vector<int>> v;
main(){
	cin>>s;
	REP(i,0,sz(s)) v[s[i]-'a'].pb(i);
	for(auto p:v){
		ma = 0;
		REP(i,1,sz(s)){
			cnt = 0;
			map<int,int> m;
			for(auto u:p.S) m[s[(u+i)%sz(s)]]++;
			for(auto u:m) if(u.S==1) cnt++;
			MAX(ma,cnt);
		}
		ans += ma;
	}
	printf("%.9lf",(double)ans/sz(s));
}


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

const int N = 100005;

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    vector <int> abc[26];
    int n = s.length();
    for (int i = 0; i < n; ++i) {
        abc[s[i] - 'a'].push_back(i);
    }
    double ans = 0;
    for (int r = 0; r < 26; ++r) if (abc[r].size()) {
        int mx = 0;
        for (int i = 1; i < n; ++i) {
            vector <int> cnt(26, 0);
            int tmp = 0;
            for (int &j : abc[r]) {
                cnt[s[(j + i) % n] - 'a']++;
                if (cnt[s[(j + i) % n] - 'a'] == 1) tmp++;
                else if (cnt[s[(j + i) % n] - 'a'] == 2) tmp--;
            }
            mx = max(mx, tmp);
        }
        ans += 1.0 * mx / n;
    }
    cout << fixed << setprecision(10) << ans << endl;
}


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

const int N = 100005;

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    vector <string> abc[26];
    int n = s.length();
    for (int i = 0; i < n; ++i) {
        abc[s[0] - 'a'].push_back(s);
        rotate(s.begin(), s.begin() + 1, s.end());
    }
    double ans = 0;
    for (int r = 0; r < 26; ++r) if (abc[r].size()) {
        cout << '\n';
        int mx = 0;
        for (int i = 1; i < n; ++i) {
            vector <int> cnt(26, 0);
            int tmp = 0;
            for (string &s : abc[r]) {
                cnt[s[i] - 'a']++;
                if (cnt[s[i] - 'a'] == 1) tmp++;
                else if (cnt[s[i] - 'a'] == 2) tmp--;
            }
            mx = max(mx, tmp);
        }
        ans += 1.0 * mx / n;
    }
    cout << fixed << setprecision(10) << ans << endl;
}


#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
string s;
int n,i,j,k,mx=0,sum=0,vis[5005],letter[26],check[26][5005][26],ok;
double ans=0;
int main()
{
	cin>>s;
	n=s.length();
	s=s+s;
	for(i=0;i<n;i++)
	{
		letter[s[i]-'a']++;
		for(j=i;j<i+n;j++)
		{
			check[s[i]-'a'][j-i+1][s[j]-'a']++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(!letter[i])continue;
		mx=-1;
		for(j=2;j<=n;j++)
		{
			sum=0;
			for(k=0;k<26;k++)if(check[i][j][k]==1)sum+=1;
			mx=max(mx,sum);
		}
		ans+=1.0*mx/n;
	}
	printf("%lf",ans);
	return 0;
}


// Marcin Knapik
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds;
// #define ordered_set tree< int , null_type,less< int >, rb_tree_tag,tree_order_statistics_node_update>
// #define ull unsigned long long
// const ull MAX_LL = 0xFFFFFFFFFFFFFFFF;
// #define losuj(a, b) uniform_int_distribution<ll>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ll> 				vll;
typedef vector<vll>   			vvll;
typedef vector<ii>				vii;
typedef vector<vi>				vvi;
typedef vector<vii> 			vvii;
#define pll pair<long long, long long>

#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second

template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<class T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

const ll INF = 1e9 + 7;
const ll mod = 100000007;
const ll BIG_INF = 1e18+7;
const ll N = 1e6+7;
const ll T = 1<<20;
const ld inf = 1e18;

ll n, m, k, q;
map<char, vector<string> > mapa;

string shift(string&s, int ile){
	string ret;
	FOR(i, n)
		ret.pb(s[(i + ile) % n]);
	return ret;
}

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

	string s;
	cin >> s;
	n = sz(s);

	FOR(i, n){
		string temp = shift(s, i);
		mapa[temp[0]].pb(temp);
	}

	ld praw = 0;
	cout << setprecision(10) << fixed;
	for(auto & u: mapa){
		ld temp = 0;

		for(int i = 0; i < n; i++){
			map<char, int> literki;
			for(auto & v : u.s)
				literki[v[i]]++;
			ld xd = 0;
			for(auto & v : literki)
				if(v.s == 1)
					xd += ((ld)sz(u.s) / n) * ((ld)v.s / sz(u.s));
			temp = max(temp, xd);
		}
		praw += temp;
	}

	cout << praw << '\n';
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=5e5+5;
int inf=1e9+1;
vector<int>node[N];
int n,has[26][5001][26];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    n=s.size();
    for(int i=0;i<n;i++){
        for(int j=1;j<n;j++){
            has[s[i]-'a'][j][s[(i+j)%n]-'a']++;
        }
    }
    int ans=0;
    for(int i=0;i<26;i++){
        int tp=0;
        for(int j=1,tp2=0;j<n;j++){
            tp2=0;
            for(int k=0;k<26;k++) tp2+=has[i][j][k]==1;
            tp=max(tp,tp2);
        }
        ans+=tp;
    }
    double a=ans,b=n,c=a/b;
    cout<<fixed<<setprecision(8)<<c<<'\n';
}


#include <bits/stdc++.h>

#define PI (3.1415926535897932L)
#define MOD (1000000007)
#define EPS (ld)(1e-9)
#define INF (2147483647)
#define LINF (9223372036854775807)

#define FAST ios::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define COUT_DOUBLE cout << fixed << setprecision(16)

#define FILEIN freopen("input.txt", "r", stdin)
#define FILEOUT freopen("output.txt", "w", stdout)
#define FILEDEF FILEIN; FILEOUT

#define er(x) {cerr << #x << ": " << (x) << endl;}
#define erIt(x) {cerr << #x << ": "; for (auto e : (x)) cerr << e << ' '; cerr << endl;}
#define erIt2(x) {cerr << #x << ":\n"; for (auto &ee : (x)) {for (auto e : ee) cerr << e << ' '; cerr << endl;}}
#define erItI(x, i) {cerr << #x << "[" << i << "]" << ": "; for (auto e : (x)[i]) cerr << e << ' '; cerr << endl;}

#define err(x) {cout << #x << ": " << (x) << endl;}
#define errIt(x) {cout << #x << ": "; for (auto e : (x)) cout << e << ' '; cout << endl;}
#define errIt2(x) {cout << #x << ":\n"; for (auto &ee : (x)) {for (auto e : ee) cout << e << ' '; cout << endl;}}
#define errItI(x, i) {cout << #x << "[" << i << "]" << ": "; for (auto e : (x)[i]) cout << e << ' '; cout << endl;}

#define IN(a) {for (auto &e : (a)) cin >> e;}
#define IN2(a) {for (auto &e : (a)) {for (auto &ee : e) cin >> ee;}}

#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define pb(x) push_back(x)

typedef long long ll;
typedef long double ld;

using namespace std;

int main() {
    FAST;
    COUT_DOUBLE;

    string s;
    cin >> s;
    int n = s.length();

    vector<vector<vector<int>>> a(30, vector<vector<int>>(n, vector<int>(30)));

    vector<bool> b(30);
    for (int i = 0; i < n; i++) {
        b[s[i] - 'a'] = 1;
        for (int j = (i + 1) % n; j != i; j = (j + 1) % n) {
            a[s[i] - 'a'][(j - i + n) % n][s[j] - 'a']++;
        }
    }

    int ans = 0;
    for (int i = 0; i < 30; i++) {
        if (b[i]) {
            int now = 0;
            int s = 0;
            for (int x = 0; x < 30; x++) s += a[i][1][x];

            for (int j = 1; j < n; j++) {
                for (int x = 0; x < 30; x++) {
                    if (a[i][j][x] == 1) {
                        now = max(now, 1);
                        if (s == 2) {
                            now = 2;
                        }
                        break;
                    }
                }
            }
            ans += now;
        }
    }

    cout << (ld)ans / (ld)n;

    return 0;
}


#include <bits/stdc++.h>

#define PI (3.1415926535897932L)
#define MOD (1000000007)
#define EPS (ld)(1e-9)
#define INF (2147483647)
#define LINF (9223372036854775807)

#define FAST ios::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define COUT_DOUBLE cout << fixed << setprecision(16)

#define FILEIN freopen("input.txt", "r", stdin)
#define FILEOUT freopen("output.txt", "w", stdout)
#define FILEDEF FILEIN; FILEOUT

#define er(x) {cerr << #x << ": " << (x) << endl;}
#define erIt(x) {cerr << #x << ": "; for (auto e : (x)) cerr << e << ' '; cerr << endl;}
#define erIt2(x) {cerr << #x << ":\n"; for (auto &ee : (x)) {for (auto e : ee) cerr << e << ' '; cerr << endl;}}
#define erItI(x, i) {cerr << #x << "[" << i << "]" << ": "; for (auto e : (x)[i]) cerr << e << ' '; cerr << endl;}

#define err(x) {cout << #x << ": " << (x) << endl;}
#define errIt(x) {cout << #x << ": "; for (auto e : (x)) cout << e << ' '; cout << endl;}
#define errIt2(x) {cout << #x << ":\n"; for (auto &ee : (x)) {for (auto e : ee) cout << e << ' '; cout << endl;}}
#define errItI(x, i) {cout << #x << "[" << i << "]" << ": "; for (auto e : (x)[i]) cout << e << ' '; cout << endl;}

#define IN(a) {for (auto &e : (a)) cin >> e;}
#define IN2(a) {for (auto &e : (a)) {for (auto &ee : e) cin >> ee;}}

#define ALL(a) (a).begin(), (a).end()
#define ALLR(a) (a).rbegin(), (a).rend()
#define pb(x) push_back(x)

typedef long long ll;
typedef long double ld;

using namespace std;

int main() {
    FAST;
    COUT_DOUBLE;

    string s;
    cin >> s;
    int n = s.length();

    vector<vector<vector<int>>> a(30, vector<vector<int>>(n, vector<int>(30)));

    vector<bool> b(30);
    for (int i = 0; i < n; i++) {
        b[s[i] - 'a'] = 1;
        for (int j = (i + 1) % n; j != i; j = (j + 1) % n) {
            a[s[i] - 'a'][(j - i + n) % n][s[j] - 'a']++;
        }
    }

    int ans = 0;
    for (int i = 0; i < 30; i++) {
        if (b[i]) {
            int now = 0;

            for (int j = 1; j < n; j++) {
                int now_now = 0;
                for (int x = 0; x < 30; x++) {
                    if (a[i][j][x] == 1) {
                        now_now++;
                    }
                }
                now = max(now_now, now);
            }
            ans += now;
        }
    }

    cout << (ld)ans / (ld)n;

    return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>

using namespace std;

const int mod = 1e9+7;
#define INF 0x3f3f3f3f
#define LL long long

struct sts
{
    LL i, k;
}st[10010], a[30010];

bool cmp(sts a, sts b)
{
    return a.k < b.k;
}

LL TT, T, n, m, cnt;
char ch;
char s[6010];
//LL a[3010];
LL b[510][510], c[514][510];
int d[30][5010][30], dd[30][5100];
LL dp[510];
LL num[510];
LL p, q, r;
LL mx = -INF, mn = INF;

LL len;

int main()
{
    LL flag, ans, fla;
    LL i, j, k, kk;

    scanf("%s", s);

	len = strlen(s);

	for(i = 0; i < len; i++)
	{
		num[s[i] - 'a']++;
		for(j = 1; j < len; j++)
		{

			if(d[s[i] - 'a'][j][s[(i + j) % len] - 'a'] == 0)
			{
				dd[s[i] - 'a'][j]++;
				d[s[i] - 'a'][j][s[(i + j) % len] - 'a'] = 1;
			}
			else if(d[s[i] - 'a'][j][s[(i + j) % len] - 'a'] == 1 )
			{
				dd[s[i] - 'a'][j]--;
				d[s[i] - 'a'][j][s[(i + j) % len] - 'a'] = 2;
			}
		}

	}

	double answ = 0.0;
	for(i = 0; i < 26; i++)
	{
        if(num[i] == 0)
            continue;
		int mxx = 0;
		for(j = 1; j < len; j++)
		{
			mxx = max(mxx, dd[i][j]);
		}
		answ += ((double)mxx * 1.0 / (double)num[i] * num[i] / len);
	//	cout << mxx << ' ' << num[i] << endl;
	}

	printf("%.15lf", answ);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

string s;
int a[5001][26][26], cnt[26], c[26][5001];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(12);
    cin >> s;
    int n = s.size();
    for(auto &i : s) cnt[i - 'a']++;
    for(int d = 0 ; d < n ; d++)
        for(int i = 0 ; i < n ; i++)
            a[d][s[i] - 'a'][s[(i + d) % n] - 'a']++;
    for(int i = 0 ; i < n ; i++)
        for(int d = 0 ; d < n ; d++)
            if(a[d][s[i] - 'a'][s[(i + d) % n] - 'a'] == 1)
                c[s[i] - 'a'][d]++;
    double ans = 0;
    for(int i = 0 ; i < 26 ; i++){
        int mx = 0;
        for(int j = 0 ; j < n ; j++)
            mx = max(mx, c[i][j]);
        ans += (double)mx / n;
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define TASK "TRY"

typedef long long ll;
ll re,cur,n,check,pos,Free[50];
double cnt,tmp;
string s;
vector <ll> d[100];

int main(){
    cin>>s;
    n=s.length();
    s=s+s;
    for (int i=0;i<n;i++){
        d[int(s[i]-'a')].push_back(i);
    }
    for (int x=0;x<26;x++){
        re=0;
        for (int k=1;k<=n-1;k++){
            cur=0;
            memset(Free,0,sizeof(Free));
            for (int i=0;i<d[x].size();i++){
                pos=d[x][i];
                Free[int(s[pos+k]-'a')]++;
            }
            for (int i=0;i<26;i++) if (Free[i]==1) cur++;
            re=max(re,cur);
        }
        cnt=cnt+re;
    }
    tmp=n;
    printf("%.15f",(cnt/tmp));
}


#include <bits/stdc++.h>
using namespace std;
#define TASK "TRY"

typedef long long ll;
ll re,cur,n,check,pos,Free[50];
double cnt,tmp;
string s;
vector <ll> d[100];

int main(){
    cin>>s;
    n=s.length();
    s=s+s;
    for (int i=0;i<n;i++){
        d[int(s[i]-'a')].push_back(i+1);
    }
    for (int x=0;x<26;x++){
        re=0;
        for (int k=1;k<=n-1;k++){
            cur=0;
            memset(Free,0,sizeof(Free));
            for (int i=0;i<d[x].size();i++){
                pos=d[x][i];
                Free[int(s[pos+k]-'a')]++;
            }
            for (int i=0;i<26;i++) if (Free[i]==1) cur++;
            re=max(re,cur);
        }
        cnt=cnt+re;
    }
    tmp=n;
    printf("%.15f",(cnt/tmp));
}


/*
 * Matheus Oliveira
 * 19:13:56 14/09/2020
 * 931e.cpp
*/

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

#define EPS
#define INF
#define MAXN 5050
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sc(x) scanf("%d", &x);
#define sc2(x, y) scanf("%d %d", &x, &y);
#define sc3(x, y, z) scanf("%d %d %d", &x, &y, &z);
#define scll(x) scanf("%lld", &x);
#define sc2ll(x, y) scanf("%lld %lld", &x, &y);
#define sc3ll(x, y, z) scanf("%lld %lld %lld", &x, &y, &z);
#define scs(str) scanf("%s", str);
#define dbv(x) cerr << #x << ": " << x << "\n";
#define dba(x, bg, ed) cerr << #x << ": "; for(int i = bg; i < ed; i++) cerr << x[i] << " \n"[i == ed-1];
#define dbp(m) for(auto e : m) cerr << "<" << e.ff << ", " << e.ss << ">" << "\n";
#define dbs(s) for(auto e : s) cerr << e << "\n";

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;

int st[30];
char inp[MAXN];

string aux;
vector<string> o[30];

int main() {
	int sz;
	double ans = 0;

	scs(inp);
	sz = strlen(inp);

	for(int i = 0; i < sz; i++) {
		aux = inp[i];
		int j = (i+1)%sz;

		while(j != i) {
			aux += inp[j++];
			j %= sz;
		}

		o[ inp[i] - 'a' ].eb(aux);
		//cout << aux << endl;
	}

	for(int i = 0; i < 26; i++) {
		double best = 0.0;
		//dbv(i);
		for(int k = 1; k < sz; k++) {
			memset(st, 0, sizeof st);
			for(int j = 0; j < (int) o[i].size(); j++) st[ o[i][j][k] - 'a' ]++;

			int cnt = 0;
			for(int j = 0; j < 26; j++) cnt += (st[j] == 1);

			best = max( best, ((double) cnt) / ((double) o[i].size()) );
		}

		ans += (((double) o[i].size()) / ((double) sz)) * best;
	}

	printf("%.17f\n", ans);
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define modulo 1000000007
#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main(){
	fast_io;
	string s;
	cin>>s;
	ll n=s.length();
	double ans=0;
	for (int j = 0; j < 26; ++j){
		vector<ll>v;
		for (int i = 0; i < n; ++i){
			if(s[i]==(j+'a'))
				v.pb(i);
		}
		if(v.size()==0)
			continue;
		if(v.size()==1){
			ans++;
			continue;
		}
		string a[v.size()];
		for (int i = 0; i < v.size(); ++i){
			a[i]=s;
			for (int k = 0; k < n; ++k){
				a[i][k]=s[(k+v[i])%n];
			}
		}
		double temp=0;
		for (int i = 0; i < n; ++i){
			int b[26]={0};
			for (int k = 0; k < v.size(); ++k){
				b[a[k][i]-'a']++;
			}
			for (int k = 0; k < 26; ++k){
				if(b[k]==1)
					temp++;
			}
		}
		temp=min(1.0*temp/v.size(),(double)v.size());
		ans+=temp;
	}
	ans=1.0*ans/n;
	cout<<setprecision(15)<<ans<<"\n";
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define modulo 1000000007
#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;
int main(){
	fast_io;
	string s;
	cin>>s;
	ll n=s.length();
	vector<ll>v[26];
	for (int i = 0; i < n; ++i){
		v[s[i]-'a'].pb(i);
	}
	double ans=0;
	for (int i = 0; i < 26; ++i){
		if(v[i].size()<=1){
			ans+=v[i].size();
			continue;
		}
		ll max1=0;
		for (int j = 0; j < n; ++j){
			ll temp=0;
			int a[26]={0};
			for (int k = 0; k < v[i].size(); ++k){
				a[s[(v[i][k]+j)%n]-'a']++;
			}
			for (int k = 0; k < 26; ++k){
				if(a[k]==1)
					temp++;
			}
			max1=max(max1,temp);
		}
		ans+=max1;
	}
	ans/=(1.0*n);
	cout<<setprecision(15)<<ans<<"\n";
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

char s[5010];
int len;
char ar[5010][5010];
int index[5010];

struct Comp
{
	bool operator()(int i, int j)
	{
		for (int k = 0; k < len; ++k)
		{
			if (ar[i][k] < ar[j][k]) return true;
			if (ar[i][k] > ar[j][k]) return false;
		}
		return false;
	}
};

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

	int i, j;
	for (i = 0; i < len; ++i)
	{
		for (j = 0; j < i; ++j)
		{
			ar[i][j + len - i] = s[j];
		}
		for (; j < len; ++j)
		{
			ar[i][j - i] = s[j];
		}
		index[i] = i;
	}

	sort(&index[0], &index[len], Comp());

	int totalcount = 0;

	for (i = 0; i < len;)
	{
		int start, end;
		int table[26];
		int k;
		int count, maxcount;

		start = i;
		for (; i < len && ar[index[i]][0] == ar[index[start]][0]; ++i);
		end = i;

		maxcount = 0;
		for (j = 1; j < len; ++j)
		{
			for (k = 0; k < 26; ++k) table[k] = 0;
			for (int k = start; k < end; ++k)
			{
				++table[ar[index[k]][j] - 'a'];
			}

			count = 0;
			for (k = 0; k < 26; ++k)
			{
				if (table[k] == 1) ++count;
			}
			if (count > maxcount) maxcount = count;
		}

		totalcount += maxcount;
	}

	printf("%lf\n", totalcount / (double)len);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

string s;
int cnt[26];
int cnt2[26];
vector<int> pos;

int main()
{
	//freopen("input.txt", "r", stdin);
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++)
		cnt[s[i] - 'a']++;
	int ans = 0;
	int mx, t;

	for (int i = 0; i < 26; i++) {
		if (cnt[i] == 1) {
			ans++;
			continue;
		}

		for (int j = 0; j < n; j++) {
			if (i == s[j] - 'a')
				pos.push_back(j);
		}

		mx = 0;
		for (int j = 0; j < n; j++) {
			t = 0;
			for (int l = 0; l < 26; l++)
				cnt2[l] = 0;
			for (int l = 0; l < pos.size(); l++) {
				cnt2[s[(pos[l] + j) % n] - 'a']++;
			}
			for (int l = 0; l < 26; l++)
				if (cnt2[l] == 1)
					t++;
			mx = max(mx, t);
		}
		ans += mx;
		pos.clear();
	}

	printf("%0.9f\n", (long double)(ans) / (long double)(n));
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

string s;
int cnt[26];
int cnt2[26];
vector<int> pos;

int main()
{
	//freopen("input.txt", "r", stdin);
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++)
		cnt[s[i] - 'a']++;
	int ans = 0;
	int mx, t;

	for (int i = 0; i < 26; i++) {
		if (cnt[i] == 1) {
			ans++;
			continue;
		}
		if (cnt[i] > 26)
			continue;

		for (int j = 0; j < n; j++) {
			if (i == s[j] - 'a')
				pos.push_back(j);
		}

		mx = 0;
		for (int j = 0; j < n; j++) {
			t = 0;
			for (int l = 0; l < 26; l++)
				cnt2[l] = 0;
			for (int l = 0; l < pos.size(); l++) {
				cnt2[s[(pos[l] + j) % n] - 'a']++;
			}
			for (int l = 0; l < 26; l++)
				if (cnt2[l] == 1)
					t++;
			mx = max(mx, t);
		}
		ans += mx;
		pos.clear();
	}

	printf("%0.8f\n", (long double)(ans) / (long double)(n));
	return 0;
}


#include <iostream>
#include<algorithm>
#include<string>
#include<map>
#include <iterator>
#include<iomanip>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<stdio.h>
#include<set>
#include <functional>

#define mod 1000000007
#define mod2 30000000
#define pa(a,b) make_pair(a,b)
#define f first
#define s second
#define pb(a)  push_back(a)
#define all(a) a.begin() , a.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define LL  long long int
#define oo 1e9
#define pi 3.14159265359
#define eps  1e-9
LL maxx(LL a , LL b){ return a>b ?  a : b ;}
LL minn(LL a , LL b){ return a>b ?  b : a ;}

using namespace std;
int dx[] = {1 , 1 ,1 , 0 , 0  , -1 , -1  , -1  , 0 };
int dy[] = { -1 , 0  , 1 , 1 , -1 , 0 , 1 , -1 , 0 };
void boostIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}
LL lcm(LL a , LL b )
{
    return (a*b)/gcd(a , b);
}
LL poww(LL base, LL exp){
  base %= mod;
  LL result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}
vector<int>let[30] ;
int main()
{
    string s ; cin >> s ;
    int n = s.size() ;
    for(int i = 0 ; i < s.size() ; i++)
        let[s[i] - 'a'].pb(i) ;
    int ans = 0 ;
    for(int i = 0 ; i < 26 ; i++){
        int mx = 0 ;
        if(let[i].empty())
            continue;
        if(let[i].size() == 1){
            ans++;
            continue;
        }
        for(int k = 1 ; k < s.size()  ; k++){
            int vis[27] = {0}  , temp = 0 ;
            for(int j = 0 ; j < let[i].size() ; j++){
                vis[s[(let[i][j] + k) % n] - 'a']++ ;
            }
            for(int j = 0 ; j < 26 ; j++)
                temp = temp + (vis[j] == 1) ;
            mx = max(mx , temp) ;
        }
        ans = ans + mx ;
    }
    cout << setprecision(20) << (double)ans / (double)n;
}


#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int a[30][30][5002];
char st[5002];
int Max(int x,int y){return x>y?x:y;}
int main()
{
    scanf("%s",st+1);
    int len=strlen(st+1);
    for(int i=1;i<=len;i++)
    {
        for(int j=1;j<len;j++)
        {
            a[st[i]-'a'+1][st[(i+j)%len+1]-'a'+1][j]++;
        }
    }
    double ans=0,max=0,kolong=0;
    for(int i=1;i<=26;i++)
    {
        max=0;
        for(int op=1;op<len;op++)
        {
            kolong=0;
            for(int j=1;j<=26;j++)
            {
                if(a[i][j][op]==1) kolong++;
            }
            max=Max(kolong,max);
        }
        ans+=double(max)/double(len)*1.0;
    }
    printf("%0.15lf\n",ans);
    return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int a[30][30][5002];
char st[5002];
int Max(int x,int y){return x>y?x:y;}
int main()
{
    scanf("%s",st);
    int len=strlen(st);
    for(int i=0;i<len;i++)
    {
        for(int j=1;j<len;j++)
        {
            a[st[i]-'a'][st[(i+j)%len]-'a'][j]++;
        }
    }
    double ans=0,max=0,kolong=0;
    for(int i=0;i<26;i++)
    {
        max=0;
        for(int op=1;op<len;op++)
        {
            kolong=0;
            for(int j=0;j<26;j++)
            {
                if(a[i][j][op]==1) kolong++;
            }
            max=Max(kolong,max);
        }
        ans+=max;
    }
    printf("%0.15lf\n",ans/len);
    return 0;
}


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

#pragma warning (disable:4996)
using namespace std;
string s;
int d[30];

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> s;
    for (int i = 0; i < 30; ++i){
        d[i] = 0;
    }
    int n = s.size();
    int answer = 0;
    int ans;
    int t;
    for (char k = 'a'; k <= 'z'; ++k) {
        ans = 0;
        for (int i = 1; i < n; ++i) {
            t = 0;
            for (int j = 0; j < 30; ++j) {
                d[j] = 0;
            }
            for (int j = 0; j < n; ++j) {
                if (s[j] == k) {
                    d[s[(j+i)%n]-'a']++;
                }
            }
            for (int j = 0; j < 30; ++j) {
                if (d[j] == 1) {
                    ++t;
                }
            }
            ans = max(ans,t);
        }
        answer += ans;
    }
    printf("%.10lf", (double)answer / (double)n);
    //cout << (double)answer/(double)n;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <map>
#include <set>

#define INF 0x3f3f3f3f
#define memset0(x) memset(x, 0, sizeof(x))
#define memsetM1(x) memset(x, -1, sizeof(x))
#define memsetINF(x) memset(x, INF, sizeof(x))

#ifndef ONLINE_JUDGE

#define dbg(x) cout << #x << " = " << x << endl

#else

#define dbg(x)

#endif

using namespace std;

int sameValue[26][5005][26];
int ansList[5005];
int counter[26];

int charToInt(char ch)
{
	return ch - 'a';
}

int main()
{
	cin.sync_with_stdio(false);
	cin.tie(0);

	string str;
	cin >> str;
	int n = str.size();
	for (int i = 0; i < n; i++)
	{
		str.push_back(str[i]);
	}

	double ans = 0;
	for (int i = 0; i < n; i++)
	{
		char first = str[i];
		counter[charToInt(first)]++;
		for (int j = i + 1; j - i + 1 <= n; j++)
		{
			sameValue[charToInt(first)][j - i][charToInt(str[j])]++;
		}
	}

	for (int i = 0; i < 26; i++)
	{
		if (counter[i] == 0)
		{
			continue;
		}
		memset0(ansList);
		for (int j = 0; j < n; j++)
		{
			for (int k = 0; k < 26; k++)
			{
				if (sameValue[i][j][k] == 1)
				{
					ansList[j]++;
				}
			}
		}
		sort(ansList, ansList + n);
		ans += double(ansList[n - 1]) / n;
	}

	printf("%lf\n", ans);

	cin.get();
	cin.get();
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
typedef long long int ll;
#define FOR(i,n,m) for (int i=(n);i<=(m);i++)
#define si(n) fscanf(in,"%d",&n)
#define NM 5005
#define MOD 1000000007
#define INF 0x7fffffff
//FILE *in=fopen("input.txt","r"), *out = fopen("output.txt", "w");
FILE *in = stdin, *out = stdout;
using namespace std;

int n, cnt[30][NM][30], alpha[NM];
char a[NM];
void input() {
	fscanf(in, "%s", a);
	n = strlen(a);
	FOR(i, 0, n - 1) alpha[a[i] - 'a']++;
}
void pro() {
	FOR(i, 0, n - 1) {
		FOR(J, 1, n - 1) {
			int j = (i + J) % n;
			cnt[a[i] - 'a'][J][a[j] - 'a']++;
		}
	}
	int ans = 0;
	FOR(i, 0, 25) {
		int MAX = 0;
		FOR(J, 1, n - 1) {
			int flag2 = 0;
			FOR(k, 0, 25) {
				if (cnt[i][J][k] == 1) {
					flag2++;
				}
			}
			MAX = max(MAX, flag2);
		}
		ans += MAX;
	}
	fprintf(out, "%.10lf", (double)ans / n);
}
int main() {
	input();
	pro();
	return 0;
}


fn main() {
    let mut input = String::new();
    use std::io;
    use std::io::prelude::*;
    io::stdin().read_to_string(&mut input).unwrap();

    let s = input.trim().as_bytes();

    let n = s.len();

    let mut lil = vec![
        LetterInfo {
            occurence_count: 0,
            possible_subsequent_values: vec![[0; 26]; n - 1]
        }; 26
    ];

    for (i, l) in s.iter().map(|&b| b - b'a').enumerate() {
        let info = &mut lil[l as usize];
        info.occurence_count += 1;
        for j in 1..n {
            let l0 = s[(i + j) % n] - b'a';
            info.possible_subsequent_values[j - 1][l0 as usize] += 1;
        }
    }

    let mut pl = Vec::with_capacity(26);

    for l in 0..26 {
        let prob = lil[l].possible_subsequent_values.iter()
            .map(|x| {
                let mut ret_val = 0;
                for p in x {
                    if *p == 1 {
                        ret_val += 1;
                    }
                }
                ret_val
            }).max().unwrap();
        pl.push(prob as f64 / n as f64);
    }

    let ans: f64 = pl.into_iter().sum();

    println!("{}", ans);
}

#[derive(Clone)]
struct LetterInfo {
    occurence_count: usize,
    possible_subsequent_values: Vec<[usize; 26]>
}


from __future__ import print_function, division
from sys import stdin, stdout
from collections import *

chrs = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:;?!"#&\'()*+,-./ '
rstr = lambda: stdin.readline().strip()
s, ans = rstr(), 0
mem, le = defaultdict(int), len(s)

for i in range(le):
    for j in range(le):
        mem[s[i], s[(j + i) % le], j] += 1

for i in range(26):
    t1 = 0
    for j in range(le):
        t2 = 0
        for k in range(26):
            t2 += (mem[chrs[i], chrs[k], j] == 1)
        t1 = max(t1, t2)

    ans += t1

print(ans / le)


from __future__ import print_function, division
from sys import stdin, stdout
from collections import *

chrs = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:;?!"#&\'()*+,-./ '
rstr = lambda: stdin.readline().strip()
s, ans = rstr(), 0
le = len(s)
mem = [[[0 for _ in range(le)] for _ in range(26)] for _ in range(26)]
get = lambda x: ord(x) - ord('a')

for i in range(le):
    for j in range(le):
        mem[get(s[i])][get(s[(j + i) % le])][j] += 1

for i in range(26):
    t1 = 0
    for j in range(le):
        t2 = 0
        for k in range(26):
            t2 += (mem[get(chrs[i])][get(chrs[k])][j] == 1)
        t1 = max(t1, t2)

    ans += t1

print(ans / le)


from __future__ import print_function, division
from sys import stdin, stdout
from fractions import gcd
# from math import *
from collections import *
from operator import mul
from functools import reduce
from copy import copy

rint = lambda: int(stdin.readline())
rints = lambda: [int(x) for x in stdin.readline().split()]

class graph:
    # initialize graph
    def __init__(self, gdict=None):
        if gdict is None:
            gdict = defaultdict(list)
        self.gdict, self.edges, self.l = gdict, defaultdict(int), defaultdict(int)

    # add edge
    def addEdge(self, node1, node2, w=None):
        self.gdict[node1].append(node2)
        self.gdict[node2].append(node1)

    def subtree(self, v):
        queue, visit = deque([[v, 0]]), [0] * (n + 1)
        visit[v], level, self.nodes, ans = 1, [0] * (n + 1), [0] * (n + 1), 0

        while queue:
            s, lev = queue.popleft()
            level[lev] = (level[lev] + 1) % 2

            for i in self.gdict[s]:
                if not visit[i]:
                    queue.append([i, lev + 1])
                    visit[i] = 1

        print(sum(level))

n, a = int(input()), rints()
g = graph()
for i in range(n - 1):
    g.addEdge(a[i], i + 2)

g.subtree(1)


import sys
from collections import defaultdict

s = sys.stdin.readline().strip()
n = len(s)

s_mp = defaultdict(list)
for i in range(n):
    s_mp[s[i]].append(i)

result = 0
for let, starts in s_mp.items():
    max_p = 0.0
    for j in range(1, n):
        cnter = defaultdict(int)
        for start in starts:
            cnter[s[(start + j) % n]] += 1

        uniq = 0
        for i, v in cnter.items():
            if v == 1:
                uniq += 1
        max_p = max(max_p, uniq/len(starts))
        total = len(starts)
    result += max_p * len(starts)/n

print('{:.8f}'.format(result))


str = input()
l = len(str)
a = []
for c in str:
    a.append(ord(c) - ord('a'))
a *= 2
tot = [[0] * l for i in range(26)]
for i in range(1, l):
    cnt = [[0] * 26 for i in range(26)]
    for j in range(l):
        cnt[a[j]][a[j + i]] += 1
    for j in range(l):
        if cnt[a[j]][a[j + i]] == 1:
            tot[a[j]][i] += 1
ans = 0
for sub in tot:
    ans += max(sub)
print(ans / l)


s=input()
n=len(s)
pos=[[] for i in range(26)]
for i in range(len(s)):
    pos[ord(s[i])-97].append(s[i:] + s[:i])
ans=0
for i in range(26):
    max1=0
    for j in range(n):
        b=[0 for i in range(26)]

        for k in pos[i]:
            b[ord(k[j])-97]+=1
        temp1=0
        for k in range(26):
            if(b[k]==1):
                temp1+=1
        max1=max(temp1,max1)
    ans+=max1
print(ans/n)


s = input()
n = len(s)
d = {}
for i in range(n):
    if s[i] not in d: d[s[i]] = []
    d[s[i]].append(s[i + 1:] + s[:i])
res = 0
for k, l in d.items():
    ans = 0
    for j in range(n - 1):
        seen, s1 = set(), set()
        for i in range(len(l)):
            if l[i][j] in s1: s1.remove(l[i][j])
            elif l[i][j] not in seen:
                s1.add(l[i][j])
                seen.add(l[i][j])
        ans = max(ans, len(s1))
    ans /= n
    res += ans
print('{:.7f}'.format(res))


s=input()

d=dict()
mod=[]
mx=[]

for k in s:
	d[k]=[]
for i in range(len(s)):
	d[s[i]].append(i)
index=0
for k in d.keys():
	mod.append(d[k])

for k in mod:
	mxct=0
	ct=0
	x=[]
	for i in range(len(s)):
		ct=0
		dic=dict()
		for j in k:
			elt = s[(j+i)%(len(s))]
			if elt in dic.keys():
				dic[elt]+=1
			else:
				dic[elt]=1
		for r in dic.keys():
			if dic[r]==1:
				ct+=1
		mxct=max(ct,mxct)
	mx.append(mxct)
sm=0
for k in mx:
	sm+=k
print(sm/len(s))


s=input()

d=dict()
mod=[]
mx=[]

for k in s:
	d[k]=[]
for i in range(len(s)):
	d[s[i]].append(i)
index=0
for k in d.keys():
	mod.append(d[k])

for k in mod:
	mxct=0
	ct=0
	x=[]
	for i in range(len(s)):
		ct=0
		dic=dict()
		for j in k:
			elt = s[(j+i)%(len(s))]
			if elt in dic:
				dic[elt]+=1
			else:
				dic[elt]=1
		for r in dic:
			if dic[r]==1:
				ct+=1
		mxct=max(ct,mxct)
	mx.append(mxct)
sm=0
for k in mx:
	sm+=k
print(sm/len(s))


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		int[][] memo=new int[26][5001];
		int[] sz=new int[26];
		for(int i=0;i<26;i++){sz[i]=0;}
		int n=s.length();
		for(int i=0;i<n;i++){
			char c=s.charAt(i);
			int p=c-'a';
			memo[p][sz[p]]=i;
			sz[p]++;
		}
		int res=0;
		for(int i=0;i<26;i++){
			int tot=0;
			for(int d=0;d<=n;d++){
				int[] fr=new int[26];
				for(int j=0;j<26;j++){fr[j]=0;}
				for(int k=0;k<sz[i];k++){
					int ind=(memo[i][k]+d)%n;
					int v=s.charAt(ind)-'a';
					fr[v]++;
				}
				int count=0;
				for(int j=0;j<26;j++){
					if(fr[j]==1){
						count++;
					}
				}
				tot=(int)Math.max(tot,count);
			}
			res+=tot;
		}
		System.out.println(1.0*res/n);
	}
}


import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class E931
{

	public static int mod = 1000000007;
	public static long INF = (1L << 60);
	static FastScanner2 in = new FastScanner2();
	static OutputWriter out = new OutputWriter(System.out);

	public static void main(String[] args)
	{

		String s=in.nextLine();
		int n=s.length();
		s=s+s;
		int[][][] seen=new int[26][n+1][26];
		int[][] ones=new int[26][n+1];
		for(int i=0;i<n;i++)
		{
			int first=s.charAt(i)-'a';
			for(int j=0;j<n;j++)
			{
				int second=s.charAt(i+j)-'a';
				seen[first][j][second]++;
				if(seen[first][j][second]==1)
				{
					ones[first][j]++;
				}
				if(seen[first][j][second]==2)
				{
					ones[first][j]--;
				}
			}
		}
		double prob=0;
		for(int i=0;i<26;i++)
		{
			int maxi=0;
			for(int j=0;j<n;j++)
			{
				maxi=max(maxi, ones[i][j]);
			}
			prob+=(double)maxi/(double)n;
		}
		out.println(prob);
		out.close();

	}

	public static long pow(long x, long n)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p))
		{
			if ((n & 1) != 0)
			{
				res = (res * p);
			}
		}
		return res;
	}

	public static long pow(long x, long n, long mod)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)
		{
			if ((n & 1) != 0)
			{
				res = (res * p % mod);
			}
		}
		return res;
	}

	public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

	static class FastScanner2
	{
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = System.in.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n)
		{
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c)
		{
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}
	}

	static class InputReader
	{
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream)
		{
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine()
		{
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					fullLine = reader.readLine();
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next()
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public long[] nextLongArray(int n)
		{
			long a[] = new long[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextLong();
			}
			return a;
		}

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

	static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}
	}
private static boolean oj = System.getProperty("ONLINE_JUDGE") != null;

	private static void tr(Object... o)
	{
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jay Leeds
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            StringBuilder s = new StringBuilder(in.nextString());
            ArrayList<ArrayList<String>> data = new ArrayList<>();
            for (int i = 0; i < 26; i++) data.add(new ArrayList<>());

            for (int i = 0; i < s.length(); i++) {
                data.get(s.charAt(0) - 97).add(s.toString());
                char c = s.charAt(0);
                s = new StringBuilder(s.substring(1));
                s.append(c);
            }

            double count = 0;
            for (int i = 0; i < 26; i++) {
                int[][] used = new int[s.length()][26];
                for (String str : data.get(i)) {
                    for (int j = 0; j < s.length(); j++) {

                        used[j][str.charAt(j) - 97]++;
                    }
                }
                double best = 0;
                for (int j = 0; j < used.length; j++) {
                    int num = 0;
                    for (int k = 0; k < 26; k++) if (used[j][k] == 1) num++;
                    best = Math.max(best, (double) num / s.length());
                }
                count += best;
            }

            out.printLine(count);

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream; //Fast IO by Egor Kulikov, modified by myself
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(double i) {
            writer.println(i);
        }

        public void close() {
            writer.close();
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author palayutm
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemEGameWithString solver = new ProblemEGameWithString();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemEGameWithString {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.next();
            int n = s.length();
            ArrayList<Integer>[] arr = new ArrayList[26];
            for (int i = 0; i < 26; i++) {
                arr[i] = new ArrayList<>();
            }
            for (int i = 0; i < n; i++) {
                arr[s.charAt(i) - 'a'].add(i);
            }
            int ans = 0;
            for (int i = 0; i < 26; i++) {
                int mx = 0;
                for (int j = 0; j < n; j++) {
                    int[] cnt = new int[26];
                    for (int p : arr[i]) {
                        cnt[s.charAt((p + j) % n) - 'a']++;
                    }
                    int c = 0;
                    for (int k = 0; k < 26; k++) {
                        if (cnt[k] == 1) c++;
                    }
                    mx = Math.max(mx, c);
                }
                ans += mx;
            }
            out.printf("%.10f\n", 1.0 * ans / n);
        }

    }

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream out) {
            super(out);
        }

        public OutputWriter(Writer out) {
            super(out);
        }

        public void close() {
            super.close();
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemE {

  private static class Node{
    Node[] c;
    short childrenCount;
    Node(){
      c = new Node[26];
      childrenCount = 0;
    }
  }

  private static class Trie{
    Node root;
    Trie(){
      root = new Node();
    }
  }

  public static void main(String[] args)throws IOException{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    char[] chars = reader.readLine().toCharArray();
    int n = chars.length;

    int[][][] firstCharLevelCharsCount = new int[26][n + 1][26];

    for(int i = 0; i < n; i++){
      // possible k
      int steps = 0;
      int level = 0;
      for(int j = i; steps < n; steps++, j = (j + 1) % n){
        firstCharLevelCharsCount[chars[i] - 'a'][level][chars[j] - 'a']++;
        level++;
      }
    }
    int res = 0;
    for(int i = 0; i < 26; i++){
      int count = 0;
      for(int j = 1; j < n; j++){
        int unique = 0;
        for(int k = 0; k < 26; k++){
          if(firstCharLevelCharsCount[i][j][k] == 1){
            unique++;
          }
        }
        count = Math.max(count, unique);
      }
      res += count;
    }
    System.out.println(res/(1.0 * n));

  }

  private static void traverse(Node node, int[][] charLevelCount, int level){
    for(int i = 0; i < 26; i++){
      if(node.c[i] != null){
        charLevelCount[level][i]++;
        traverse(node.c[i], charLevelCount, level + 1);
      }
    }
  }

  private static boolean couldBeStart(Node node){
    if(node.childrenCount == 1){
      for(int i = 0; i < 26; i++){
        if(node.c[i] != null){
          return couldBeStart(node.c[i]);
        }
      }
    }

    if(node.childrenCount == 0){
      return true;
    }

    for(int i = 0; i < 26; i++){
      if(node.c[i] != null){
        int leafCount = getLeafCount(node.c[i]);
        if(leafCount > 1){
          return false;
        }
      }
    }
    return true;
  }

  private static int getLeafCount(Node node){
    if(node.childrenCount == 0){
      return 1;
    }
    int ret = 0;
    for(int i = 0; i < 26; i++){
      if(node.c[i] != null) {
        ret += getLeafCount(node.c[i]);
      }
    }
    return ret;
  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemE {
  public static void main(String[] args)throws IOException{

    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    char[] chars = reader.readLine().toCharArray();

    int n = chars.length;

    int[][][] firstCharLevelCharsCount = new int[26][n + 1][26];

    for(int i = 0; i < n; i++){
      int steps = 0;
      int level = 0;
      for(int j = i; steps < n; steps++, j = (j + 1) % n){
        firstCharLevelCharsCount[chars[i] - 'a'][level][chars[j] - 'a']++;
        level++;
      }
    }

    int res = 0;
    for(int i = 0; i < 26; i++){
      int count = 0;
      for(int j = 1; j < n; j++){
        int unique = 0;
        for(int k = 0; k < 26; k++){
          if(firstCharLevelCharsCount[i][j][k] == 1){
            unique++;
          }
        }
        count = Math.max(count, unique);
      }
      res += count;
    }
    System.out.println(res/(1.0 * n));

  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class GameWithString {
    void solve() {
        char[] s = in.nextToken().toCharArray();
        int n = s.length;

        int[] cnt = new int[26];
        for (int i = 0; i < n; i++) cnt[s[i] - 'a']++;
        int[][] pos = new int[26][];
        for (int i = 0; i < 26; i++) pos[i] = new int[cnt[i]];
        for (int i = n - 1; i >= 0; i--) pos[s[i] - 'a'][--cnt[s[i] - 'a']] = i;

        s = Arrays.copyOf(s, n << 1);
        for (int i = 0; i < n; i++) s[n + i] = s[i];

        int ans = 0;
        for (int c = 0; c < 26; c++) {
            if (pos[c].length == 0) continue;
            int best = 0;
            for (int d = 1; d < n; d++) {
                int[] test = new int[26];
                for (int i : pos[c]) {
                    test[s[i + d] - 'a']++;
                }
                int distinct = 0;
                for (int i = 0; i < 26; i++) {
                    if (test[i] == 1) distinct++;
                }
                best = Math.max(best, distinct);
            }
            ans += best;
        }
        out.println((double) ans / n);
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new GameWithString().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

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

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


import java.util.*;
import java.io.*;
import java.text.DecimalFormat;

public class E {

	static final boolean stdin = true;
	static final String filename = "";
	static FastScanner br;
	static PrintWriter pw;

	public static void main(String[] args) throws IOException {

		if (stdin) {
			br = new FastScanner();
			pw = new PrintWriter(new OutputStreamWriter(System.out));
		} else {
			br = new FastScanner(filename + ".in");
			pw = new PrintWriter(new FileWriter(filename + ".out"));
		}

		Solver solver = new Solver();
		solver.solve(br, pw);
	}

	static class Solver {
		static long mod = (long) (1e9);

		public void solve(FastScanner br, PrintWriter pw) throws IOException {
			String st = br.nt();
			String s = st;
			int L = st.length();
			ArrayList<ArrayList<String>> allRotationStartingWith = new ArrayList<ArrayList<String>>();
			for (int i = 0; i < 26; i++)
				allRotationStartingWith.add(new ArrayList<String>());

			for (int i = 0; i < L; i++) {
				allRotationStartingWith.get(s.charAt(0)-97).add(s);
				s = s.substring(1) + s.charAt(0);
			}

			double sumOfAllHighestProbabilities = 0;

			for (int startingLetterOfRotation = 0; startingLetterOfRotation < 26; startingLetterOfRotation++) {

				int[][] countsOfLettersSomeDistanceFromStartOfRotation = new int[L][26];

				for (String rotation : allRotationStartingWith.get(startingLetterOfRotation))
					for (int distanceFromStartOfRotation = 0; distanceFromStartOfRotation < L; distanceFromStartOfRotation++)
						countsOfLettersSomeDistanceFromStartOfRotation[distanceFromStartOfRotation][rotation.charAt(distanceFromStartOfRotation) - 97]++;

				double highestProbabilityOfFindingStringShiftWithThisStartingLetterOfRotation = 0;

				for (int distanceFromStartOfRotation = 0; distanceFromStartOfRotation < L; distanceFromStartOfRotation++) {

					double counterOfUniqueEndingLetterForSpecificDistanceFromStartOfRotation = 0;

					for (int endingLetter = 0; endingLetter < 26; endingLetter++)
						if (countsOfLettersSomeDistanceFromStartOfRotation[distanceFromStartOfRotation][endingLetter] == 1)
							counterOfUniqueEndingLetterForSpecificDistanceFromStartOfRotation++;

					highestProbabilityOfFindingStringShiftWithThisStartingLetterOfRotation = Math.max(highestProbabilityOfFindingStringShiftWithThisStartingLetterOfRotation, counterOfUniqueEndingLetterForSpecificDistanceFromStartOfRotation / L);

				}

				sumOfAllHighestProbabilities += highestProbabilityOfFindingStringShiftWithThisStartingLetterOfRotation;

			}

			pw.println(new DecimalFormat("#0.000000000000000").format(sumOfAllHighestProbabilities));
			pw.close();
		}

		static long gcd(long a, long b) {
			if (a > b)
				return gcd(b, a);
			if (a == 0)
				return b;
			return gcd(b % a, a);
		}

		static long lcm(long a, long b) {
			return a * (b / gcd(a, b));
		}

		static long pow(long a, long b) {
			if (b == 0)
				return 1L;
			long val = pow(a, b / 2);
			if (b % 2 == 0)
				return val * val % mod;
			else
				return val * val % mod * a % mod;
		}

	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

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

		ArrayList<Integer>[] ng(int n, int e) {
			ArrayList<Integer>[] adj = new ArrayList[n];
			for (int i = 0; i < n; i++) {
				adj[i] = new ArrayList<Integer>();
			}
			for (int i = 0; i < e; i++) {
				int a = ni() - 1;
				int b = ni() - 1;
				adj[a].add(b);
				adj[b].add(a);
			}
			return adj;
		}

		Integer[] nIa(int n) {
			Integer[] arr = new Integer[n];
			for (int i = 0; i < n; i++) {
				arr[i] = ni();
			}
			return arr;
		}

		int[] nia(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = ni();
			}
			return arr;
		}

		Long[] nLa(int n) {
			Long[] arr = new Long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nl();
			}
			return arr;
		}

		long[] nla(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nl();
			}
			return arr;
		}

		String[] nsa(int n) {
			String[] arr = new String[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nt();
			}
			return arr;
		}

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

		int ni() {
			return Integer.parseInt(nt());
		}

		long nl() {
			return Long.parseLong(nt());
		}

		double nd() {
			return Double.parseDouble(nt());
		}

	}
}


import java.io.*;
import java.util.*;
public class CF931_D2_E{
	public static void main(String[] args)throws Throwable {
		MyScanner sc=new MyScanner();
		PrintWriter pw=new PrintWriter(System.out);

		String s=sc.next();
		int n=s.length();
		ArrayList<String> [] arr=new ArrayList [26];
		for(int i=0;i<26;i++)
			arr[i]=new ArrayList<String>();
		for(int i=0;i<n;i++){
			s=s.substring(1)+s.charAt(0);
			arr[s.charAt(0)-'a'].add(s);
		}
		double ans=0;
		for(int i=0;i<26;i++){
			int mx=0;
			for(int j=1;j<n;j++){
				boolean [] v=new boolean [26];
				boolean [] valid=new boolean [26];
				Arrays.fill(valid, true);
				for(int k=0;k<arr[i].size();k++){
					if(v[arr[i].get(k).charAt(j)-'a'])
						valid[arr[i].get(k).charAt(j)-'a']=false;
					v[arr[i].get(k).charAt(j)-'a']=true;
				}
				int cc=0;
				for(int ii=0;ii<26;ii++)
					if(v[ii] && valid[ii])
						cc++;
				mx=Math.max(mx, cc);
			}
			ans+=(1.0*mx/n);
		}
		pw.println(ans);
		pw.flush();
		pw.close();
	}

	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {while (st == null || !st.hasMoreElements()) {
			try {st = new StringTokenizer(br.readLine());}
			catch (IOException e) {e.printStackTrace();}}
		return st.nextToken();}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() {return Double.parseDouble(next());}
		String nextLine(){String str = "";
		try {str = br.readLine();}
		catch (IOException e) {e.printStackTrace();}
		return str;}
	}
}


import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;
public class code5 {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	static int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
	ArrayList<Integer> al[];
	void solve() throws IOException
	{
		String s=ns();
		int n=s.length();
		s=s+s;
		int count=0;
		for(int i=0;i<26;i++)
		{
			ArrayList<Integer> al=new ArrayList<Integer>();
			for(int j=0;j<n;j++)
			{
				if(s.charAt(j)-'a'==i)
					al.add(j);
			}
			int max=0;
			for(int j=1;j<n;j++)
			{
				int hash[]=new int[26];
				Arrays.fill(hash,-1);
				int temp=0;
				for(int k=0;k<al.size();k++)
				{
					char ch=s.charAt(al.get(k)+j);
					if(hash[ch-'a']==-1)
						hash[ch-'a']=k;
					else
						hash[ch-'a']=-2;
				}
				for(int k=0;k<26;k++)
				{
					if(hash[k]!=-1&&hash[k]!=-2)
					{
						temp++;
					}
				}
				max=Math.max(max,temp);
			}
			count+=max;
		}
		out.println(count*1.0/n);
	}
	long ncr[][];
	int small[];
	void pre(int n)
	{
		small=new int[n+1];
		for(int i=2;i*i<=n;i++)

		{
			for(int j=i;j*i<=n;j++)
			{
				if(small[i*j]==0)
					small[i*j]=i;
			}
		}
		for(int i=0;i<=n;i++)
		{
			if(small[i]==0)
				small[i]=i;
		}
	}
	int sum(int i)
	{
		int sum=0;
		while(i!=0)
		{
			if((i%10)%2==1)
				sum+=i%10;
			i/=10;
		}
		return sum;
	}
	/*ArrayList<Integer> al[];
 	void take(int n,int m)
 	{
 		al=new ArrayList[n];
 		for(int i=0;i<n;i++)
 			al[i]=new ArrayList<Integer>();
 		for(int i=0;i<m;i++)
 		{
 			int x=ni()-1;
 			int y=ni()-1;
 			al[x].add(y);
 			al[y].add(x);
 		}
 	}*/
 	int check(long n)
 	{
 		int count=0;
 		while(n!=0)
 		{
 			if(n%10!=0)
 				break;
 			n/=10;
 			count++;
 		}
 		return count;
 	}
	public static int count(int x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	       int x,y,k;
	       int i,dir;
	       long val;
	       double pos;
		Pair (int x,int y){
			this.x=x;
			this.y=y;
		}
		public int compareTo(Pair o) {
			return Double.compare(this.pos,o.pos);
		}

		public String toString(){
			return x+" "+y+" "+k+" "+i+" "+val;}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode() ;
		}
	}

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(y==0)
			return x;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new code5().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

	    	//new code5().run();
		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}
		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
    long MOD = 1000000007L;
    int INF = 1000000000;

    public class Obj implements Comparable<Obj>{
        public int start;
        public int end;

        public Obj(int start_, int end_){
            this.start = start_;
            this.end = end_;

        }

        public int compareTo(Obj other){
            if (other.start == this.start){
                return this.end - other.end;
            }
            return this.start - other.start;
        }

    }

	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
        Codechef cf = new Codechef();
        cf.Solve();
	}

	public void Solve(){
        MyScanner sc = new MyScanner();
        String s = sc.nextLine();
        char[] arr = s.toCharArray();
        int len = arr.length;
        int[] cnt = new int[26];
        boolean[] ok = new boolean[26];
        int[] pos = new int[len];
        int[][] cnt2 = new int[5000][26];
        int num = 0;
        double res = 0.0;
        for (int i = 0; i < 26; ++i){
            char c = (char)(i + 'a');
            int sz = 0;
            for (int j = 0; j < len; ++j){
                if (c == arr[j]){
                    cnt[i]++;
                    pos[sz++] = j;
                }
            }
            if (sz == 0) continue;
            for (int k = 1; k < len; ++k){
                for (int j = 0; j < 26; ++j){
                    cnt2[k][j] = 0;
                }
            }
            for (int k = 1; k < len; ++k){
                for (int j = 0; j < sz; ++j){
                    int curP = (pos[j] + k) % len;
                    int idx = (int)(arr[curP] - 'a');
                    cnt2[k][idx]++;
                }
            }
            int best = 0;
            for (int k = 1; k < len; ++k){
                int cur = 0;
                for (int j = 0; j < sz; ++j){
                    int curP = (pos[j] + k) % len;
                    int idx = (int)(arr[curP] - 'a');
                    if (cnt2[k][idx] == 1){
                        cur++;
                    }
                }
                best = Math.max(best, cur);
            }
            num += best;
        }
        res = 1.0 * num / len;
        System.out.println(res);
	}

	//-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;

   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

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

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

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

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

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

      String nextLine(){
          String str = "";
      try {
         str = br.readLine();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return str;
      }

   }
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.TreeSet;

public final class CF_468_E {

	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X,int L){if (verb) {for (int i=0;i<L;i++) System.err.print(X[i]+" ");System.err.println("");}}
	static void log(long[] X){if (verb) {for (long U:X) System.err.print(U+" ");System.err.println("");}}

	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}

	// Global vars
	static BufferedWriter out;
	static InputReader reader;

	static void process() throws Exception {

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader=new InputReader(System.in);

		String s=reader.readString();
		int L=s.length();
		int CX=26;
		int[] cnt=new int[CX];
		for (int i=0;i<L;i++)
			cnt[s.charAt(i)-'a']++;

		char[] mem=new char[2*L];
		for (int u=0;u<2*L;u++)
			mem[u]=s.charAt(u%L);
		ArrayList<String>[] hs=new ArrayList[CX];

		int[][][] used=new int[CX][L][CX];
		int[] num=new int[CX];
		for (int i=0;i<L;i++){
			// pick shifted
			// look at begining
			// see if we can differentiate
			// start at i
			int x=mem[i]-'a';
			num[x]++;
			for (int u=0;u<L;u++){
				int y=mem[i+u]-'a';
				used[x][u][y]=1;
			}
		}
		int win=0;
		int lose=0;
		for (int u=0;u<CX;u++){
			if (num[u]>0){
				log((char)(u+'a')+" "+num[u]);
				boolean found=false;
				lp:for (int i=0;i<L;i++){
					int diff=0;
					for (int v=0;v<CX;v++){
						if (used[u][i][v]==1)
							diff++;
					}
					if (diff==num[u]){
						found=true;
						break lp;
					}
				}
				if (found)
					win+=num[u];
				else
					lose+=num[u];
			}
		}

		double res=win;
		res/=(win+lose);
		double min=1;
		min/=L;
		res=Math.max(res,min);
		output(res);

		try {
			out.close();
		}
		catch (Exception EX){}

	}

	public static void main(String[] args) throws Exception {
		process();

	}

	static final class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read(buf);
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public final String readString() throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res=new StringBuilder();
			do {
				res.append((char)c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final int readInt() throws IOException {
			int c = read();
			boolean neg=false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d=(char)c;
			//log("d:"+d);
			if (d=='-') {
				neg=true;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			//log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		public final long readLong() throws IOException {
			int c = read();
			boolean neg=false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d=(char)c;
			//log("d:"+d);
			if (d=='-') {
				neg=true;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			//log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

}