fabbbhgedd
 abbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaab
 hcdhgcchbdhbeagdcfedgcbaffebgcbcccadeefacbhefgeadfgchabgeebegahfgegahbddedfhffeadcedadgfbeebhgfahhfb
 khjcoijiicdkdianmdolmadobdkcmgifdnffddnjehhbldlkjffknficdcmokfacioiegjedbmadjioomdacbodcajcmonmnlabo
 bababbdaee
 cbbbbcaaca
 gaejllebhn
 eaaebccaeacdecaedcaabbbdeebccdcdaabeeaeeaddbaabdccebecebbbbedbdcbbbbbbecbaddcddcccdcbbadbecddecedbba
 difhjdjbcdjedhiegagdejkbjfcdcdagdijdjajecbheiabfbjdgjdecfhdkgdbkcgcgakkiiggfkgcfadkjhiijkjacgejfhjge
 bbababaaababaabbbbbabbbbbbaaabbabaaaaabbbbbaaaabbbbabaabaabababbbabbabbabaaababbabbababaaaaabaaaabbb
 cadbcdddda
 kpsaloedscghjeaqadfhmlibjepjafdomkkorinrpakondtnrnknbqarbejcenrlsbfgdbsdmkpphbkdnbitjfcofsjibssmmlll
 aaabbbaaaabbbbaaabbbbbaabbbbaaababbaaabbbbaaabbbbababbbbaaabbbbaaabbbbbaabbbbaaabbbbaaabbbb
 ibledofnibedebifmnjdoaijeghajecbkjaebbkofnacceaodiifbhgkihkibddneeiemacodeafeaiiiaoajhmkjffbmmiehebhokfklhbkeoanoajdedjdlkbhenidclagggfhhhldfleccgmjbkhaginlhabkabagikalccndciokabfaebjkndf
 abbacba
 jkeaagakbifeaechkifkdghcjcgighidcgdccfbdbcackfgaebkddabgijkhjkaffkabacekdkjekeccegbecbkecbgbgcacgdackcdfjefaifgbigahkbedidfhjbikejdhejcgideaeejdcegeeccaefbddejkbdkfagfcdjbikbidfggkidcdcic

1.000000000000000
 0.000000000000000
 0.450000000000000
 0.960000000000000
 1.000000000000000
 0.800000000000000
 1.000000000000000
 0.080000000000000
 0.840000000000000
 0.000000000000000
 0.800000000000000
 1.000000000000000
 0.000000000000000
 0.786096256684492
 1.000000000000000
 0.438502673796791

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;

typedef long long ll;

typedef long double ldb;

typedef pair<ll,ll> pll;

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



#define ff first

#define ss second

#define pb push_back

#define mp make_pair

#define V vector

#define endl "\n"

#define CLEAR(a) memset(a,-1,sizeof(a))

#define all(x) x.begin(),x.end()

#define sz(x) ((ll)x.size())

#define rep0(i,n) for(ll i=0;i<n;i++)

#define rep1(i,n) for(ll i=1;i<=n;i++)

#define per(i,a,b) for(ll i=a;i>=b;i--)

#define ios_tie() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(nullptr)

#define trace1(a)             cout <<#a<<":"<<a<< endl;

#define trace2(a,b)           cout <<#a<<":"<<a<<" | "<<#b<<":"<<b<< endl;

#define trace3(a,b,c)         cout <<#a<<":"<<a<<" | "<<#b<<":"<<b<<" | "<<#c<<":"<<c<<endl;

#define trace4(a,b,c,d)       cout <<#a<<":"<<a<<" | "<<#b<<":"<<b<<" | "<<#c<<":"<<c<<" | "<<#d<<":"<<d<<endl;



const ll inf = LLONG_MAX;

const ll mod = 998244353;

const ll maxn = 1e5;

const ldb PI = acos(-1);



void lol(ll s) {cerr<<"check........................................... "<<s<<endl;}

ll power(ll x,ll y) {ll res=1; x%=mod; while(y) {if(y&1) res=(res*x)%mod; y>>=1LL; x=(x*x)%mod; }return res;}

ll inv(ll x) {return power(x,mod-2);}//(1/x)%y = x^(y-2) % y;	// pow(x,y)%m = pow(x,y%(m-1))%m

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll gcd(ll a, ll b) {while(b) b ^= a ^= b ^= a %= b; return a;}

int main()

{

    ios_tie();
    string s;
    cin>>s;
    ll den = sz(s);
    s += s;
    V<string> v[26];
    rep0(i,sz(s)/2)
    	v[s[i]-'a'].pb(s.substr(i,den));
    ll cnt = 0;
	rep0(i,26)
	{
		if(sz(v[i])==0)
			continue;
		ll mx = 0;
		rep0(j,den)
		{
			ll freq[26] = {0};
			rep0(k,sz(v[i]))
				freq[v[i][k][j]-'a']++;
			ll tmp = count(freq,freq+26,1);
			mx = max(mx,tmp);
		}
		cnt += mx;
	}  
	if(cnt==0)
		cnt++;
	cout<<fixed<<setprecision(15)<<1.0*cnt/den<<endl;
    return 0;

}

