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

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

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

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

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

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

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

void run();

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

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

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

// ---SOLUTION--- //

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


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

#define F first
#define S second

#define en end()
#define bg being()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y0123456789
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x) * 1ll * (x))
#define sqrd(x) ((x) * 1.0 * (x))

#define forn(i, x) for (int i = 1; i <= x; i++)

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int N = 5005;

bool ok[N];
char c[N][N];
vector < int > v[26];
int n, good, tot, cnt[N][26];

int main() {
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    //freopen(".err", "w", stderr);

    //srand(time(NULL));

    //cin.tie(NULL);
    //cout.tie(NULL);
    //ios_base::sync_with_stdio(false);

    //cout << setprecision(10) << fixed;

    scanf("%s", c[1] + 1);

    n = len(c[1] + 1);

    for (int i = 2; i <= n; i++) {
        for (int j = 2; j <= n; j++)
            c[i][j] = c[i - 1][j - 1];
        c[i][1] = c[i - 1][n];
    }

    for (int i = 1; i <= n; i++)
        v[c[i][1] - 'a'].pb(i);

    for (int it = 0; it < 26; it++) {
        for (auto i : v[it]) {
            for (int j = 2; j <= n; j++) {
                ok[j] = 1;
                cnt[j][c[i][j] - 'a']++;
            }
        }
        bool found = 0;
        for (auto i : v[it]) {
            for (int j = 2; j <= n; j++) {
                ok[j] &= (cnt[j][c[i][j] - 'a'] == 1);
                found |= (cnt[j][c[i][j] - 'a'] == 1);
            }
        }
        int add = 0;
        if (found)
            add = 1;
        for (int j = 2; j <= n; j++)
            if (ok[j])
                add = sz(v[it]);
        good += add;
        for (auto i : v[it]) {
            for (int j = 2; j <= n; j++)
                cnt[j][c[i][j] - 'a']--;
        }
    }

    printf("%.10f", (good + 0.0) / n);

    //cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

    return 0;
}


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

#define F first
#define S second

#define en end()
#define bg being()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y0123456789
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x) * 1ll * (x))
#define sqrd(x) ((x) * 1.0 * (x))

#define forn(i, x) for (int i = 1; i <= x; i++)

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int N = 5005;

char c[N][N];
vector < int > v[26];
int n, good, tot, val[N], cnt[N][26];

int main() {
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    //freopen(".err", "w", stderr);

    //srand(time(NULL));

    //cin.tie(NULL);
    //cout.tie(NULL);
    //ios_base::sync_with_stdio(false);

    //cout << setprecision(10) << fixed;

    scanf("%s", c[1] + 1);

    n = len(c[1] + 1);

    for (int i = 2; i <= n; i++) {
        for (int j = 2; j <= n; j++)
            c[i][j] = c[i - 1][j - 1];
        c[i][1] = c[i - 1][n];
    }

    for (int i = 1; i <= n; i++)
        v[c[i][1] - 'a'].pb(i);

    for (int it = 0; it < 26; it++) {
        for (auto i : v[it])
            for (int j = 2; j <= n; j++)
                cnt[j][c[i][j] - 'a']++;
        memset(val, 0, sizeof(val));
        for (auto i : v[it])
            for (int j = 2; j <= n; j++)
                val[j] += (cnt[j][c[i][j] - 'a'] == 1);
        int mx = 0;
        for (int j = 2; j <= n; j++)
            mx = max(mx, val[j]);
        good += mx;
        for (auto i : v[it])
            for (int j = 2; j <= n; j++)
                cnt[j][c[i][j] - 'a']--;
    }

    printf("%.10f", (good + 0.0) / n);

    //cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

    return 0;
}


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

int main()
{
	string s;
	cin>>s;
	vector<int> v[26];
	for(int i=0;i<s.size();i++)
	{
		v[s[i]-'a'].push_back(i);
	}
	int cnt=0;
	for(int i=0;i<26;i++)
	{
		int n=1;
		int maxx=0;
		while(v[i].size()&&n<s.size())
		{
			int c=0;
			vector<int> a[26];
			for(auto j:v[i])
			{
				a[s[(j+n)%s.size()]-'a'].push_back(j);
			}
			vector<int> x;
			for(int j=0;j<26;j++)
			{
				if(a[j].size()==1)
				{
					c++;
					//cout<<a[j][0]<<" "<<n<<endl;
					//vis[a[j][0]]=1;
				}
			}
			maxx=max(maxx,c);
			n++;
		}
		cnt+=maxx;
	}
	cout<<setprecision(25)<<(double)(cnt)/s.size();
}


#include <bits/stdc++.h>

#define sqr(a) (a) * (a)
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define endl "\n"

typedef long long ll;
const int MAXN = 11234;
const int MAXINT = 2147483640;
const ll MAXLL = 9223372036854775800LL;
const int MAXANS = 1000000007;
const int MOD = 1000000123;
const int MOD2 = 1000000321;
using namespace std;

vector < pair < string, int > > v[369];
int k[MAXN], p[MAXN], res[369][MAXN];
int main(){
//    freopen("1.in", "r", stdin);
//    freopen("1.out", "w", stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    srand(time(0));
    string s;
    int i, j, c;
    cin >> s;
    for (i = 1; i <= s.size(); i++){
        v[s[0]].p_b(m_p(s, 0));
        s = s.substr(1, s.size() - 1) + s[0];
    }
    for (i = 1; i < s.size(); i++){
        for (c = 'a'; c <= 'z'; c++){
            for (j = 'a'; j <= 'z'; j++) k[j] = 0;
            for (j = 0; j < v[c].size(); j++) ++k[v[c][j].fi[i]], p[v[c][j].fi[i]] = j;

            for (j = 'a'; j <= 'z'; j++) if (k[j] == 1) ++res[c][i];
        }
    }

    int ans = 0, mx;
    for (c = 'a'; c <= 'z'; c++){
        mx = 0;
        for (j = 0; j < s.size(); j++) mx = max(mx, res[c][j]);
        ans += mx;
    }
    for (c = 'a'; c <= 'z'; c++)
        for (j = 0; j < v[c].size(); j++) ans += v[c][j].se;
    cout << fixed << setprecision(9) << double(ans) / s.size() << endl;
    return 0;
}


#include <bits/stdc++.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327
#endif // M_PI
#define endl "\n"
#define S struct
#define X first
#define Y second
#define V vector
#ifndef __linux__
#define LLD "%I64d"
#else
#define LLD "%ll""d"
#endif
#define FOR(x, y, z) for (int x = (y); x < (z); ++x)
#define FORR(x, y, z) for (int x = (y); x > (z); --x)
#define GET(a, n) for (int __i = 0; __i < (n); ++__i) cin >> a[__i];
#define GETM(a, n, m) for (int __i = 0; __i < (n); ++__i) for (int __j = 0; __j < m; ++__j) cin >> a[__i][__j];
#define PRINTM(a, n, m) for (int __i = 0; __i < (n); ++__i) { for (int __j = 0; __j < m; ++__j) cout << a[__i][__j] << " ";  cout << endl; };
#define PRINT(a, n) for (int __i = 0; __i < (n); ++__i) cout << a[__i] << " ";
#define IT(a) a.begin(), a.end()
#define SQR(x) (x) * (x)
#define CASE(a, s) cout << "Case #" << a << ": " << s << endl;
#define DEB(a) cout << #a << " = " << (a) << endl; cout.flush();
#define DEBA(a) for (auto __i: a) cout << __i << " "; cout << endl; cout.flush();
#define IFDEB(b, a) if (b) { cout << #a << " = " << (a) << endl; cout.flush(); }
#define YESNO(cond) cout << ((cond) ? "Yes" : "No") << endl;
#define UMAX(left, right) left = max(left, right);
#define UMIN(left, right) left = min(left, right);
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;
const int MOD = 1000000007;
void yes() { cout << "Yes" << endl;}
void no() { cout << "No" << endl;}
S Sync_stdio { Sync_stdio() { cin.tie(NULL); ios_base::sync_with_stdio(false); } } _sync_stdio;
S FAIL { FAIL () { cout << "CHANGE!!!" << endl;}};

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    vector<LL> res(26);
    FOR (i, 0, n) {
        vector<int> v(26 * 26);
        vector<LL> tres(26);
        string s2 = s;
        std::rotate(s2.begin(), s2.begin() + i, s2.end());
        FOR (j, 0, n) {
            ++v[(s[j] - 'a') * 26 + (s2[j] - 'a')];
        }
        FOR (j, 0, 26 * 26) {
            if (v[j] == 1) {
                ++tres[j / 26];
            }
        }
        FOR (j, 0, 26) {
            res[j] = max(res[j], tres[j]);
        }
    }
    cout << fixed << setprecision(15) << accumulate(IT(res), 0LL) * 1.0 / n;
}


#include <bits/stdc++.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327
#endif // M_PI
#define endl "\n"
#define S struct
#define X first
#define Y second
#define V vector
#ifndef __linux__
#define LLD "%I64d"
#else
#define LLD "%ll""d"
#endif
#define FOR(x, y, z) for (int x = (y); x < (z); ++x)
#define FORR(x, y, z) for (int x = (y); x > (z); --x)
#define GET(a, n) for (int __i = 0; __i < (n); ++__i) cin >> a[__i];
#define GETM(a, n, m) for (int __i = 0; __i < (n); ++__i) for (int __j = 0; __j < m; ++__j) cin >> a[__i][__j];
#define PRINTM(a, n, m) for (int __i = 0; __i < (n); ++__i) { for (int __j = 0; __j < m; ++__j) cout << a[__i][__j] << " ";  cout << endl; };
#define PRINT(a, n) for (int __i = 0; __i < (n); ++__i) cout << a[__i] << " ";
#define IT(a) a.begin(), a.end()
#define SQR(x) (x) * (x)
#define CASE(a, s) cout << "Case #" << a << ": " << s << endl;
#define DEB(a) cout << #a << " = " << (a) << endl; cout.flush();
#define DEBA(a) for (auto __i: a) cout << __i << " "; cout << endl; cout.flush();
#define IFDEB(b, a) if (b) { cout << #a << " = " << (a) << endl; cout.flush(); }
#define YESNO(cond) cout << ((cond) ? "Yes" : "No") << endl;
#define UMAX(left, right) left = max(left, right);
#define UMIN(left, right) left = min(left, right);
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;
const int MOD = 1000000007;
void yes() { cout << "Yes" << endl;}
void no() { cout << "No" << endl;}
S Sync_stdio { Sync_stdio() { cin.tie(NULL); ios_base::sync_with_stdio(false); } } _sync_stdio;
S FAIL { FAIL () { cout << "CHANGE!!!" << endl;}};

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    LL res = 0;
    FOR (i, 0, n) {
        vector<int> v(26 * 26);
        LL tres = 0;
        string s2 = s;
        std::rotate(s2.begin(), s2.begin() + i, s2.end());
        FOR (j, 0, n) {
            ++v[(s[j] - 'a') * 26 + (s2[j] - 'a')];
        }
        FOR (j, 0, 26 * 26) {
            if (v[j] == 1) {
                ++tres;
            }
        }
        res = max(res, tres);
    }
    cout << fixed << setprecision(15) << res * 1.0 / n;
}


#include <bits/stdc++.h>

#define pii pair<int, int>
#define f first
#define s second
#define ll long long
#define pll pair<ll, ll>
#define all(a) a.begin(), a.end()
#define sz(a) int(a.size())
#define r(a) int(a - 'a')

using namespace std;

const int INF = 1e9;

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

    cout << setprecision(10) << fixed;

    string s;
    cin >> s;
    int n = sz(s);
    vector<int> ch[26];
    for (int i = 0; i < n; ++i) {
        ch[r(s[i])].emplace_back(i);
    }
    int cur = 0;
    for (int i = 0; i < 26; ++i) {
        int curm = 0;
        for (int j = 1; j < n; ++j) {
            int x[26] = {};
            for (auto el : ch[i]) {
                ++x[r(s[(el + j) % n])];
            }
            int curc = 0;
            for (int k = 0; k < 26; ++k) {
                if (x[k] == 1) {
                    ++curc;
                }
            }
            curm = max(curm, curc);
        }
        cur += curm;
    }
    cout << double(cur) / n;
    return 0;
}


#pragma gcc optimize("OFast")
#pragma gcc target("sse,sse2,sse3,sse4,tune=native")
//#pragma gcc optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
const int maxn = 1e5, INF = 1e9;
const ll llINF = 1e18;

int cnt[26][26][5000], c[26][5000];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //freopen("in.txt", "r", stdin);
    string s; cin >> s;
    for(int i = 0; i < sz(s); i++)
        for(int j = i + 1; j <= i + sz(s) - 1; j++) {
            cnt[s[i] - 'a'][s[j % sz(s)] - 'a'][j - i]++;
        }

    bitset<5000> di[26];
    vector<vector<int>> cgood(26, vector<int>(5000, 0)), cbad(26, vector<int>(5000, 0));
    for(int ch = 0; ch < 26; ch++)
        for(int d = 1; d < sz(s); d++)
            for(int ch1 = 0; ch1 < 26; ch1++) {
                cgood[ch][d] += (cnt[ch][ch1][d] == 1);
                cbad[ch][d] += (cnt[ch][ch1][d] > 1);
            }

    vector<int> ccc(26, 0);
    for(char ch : s) ccc[ch - 'a']++;

    double P = 0;
    for(int ch = 0; ch < 26; ch++) {
        if(ccc[ch] == 0) continue;
        double pp = (.0 + ccc[ch]) / sz(s);
        double hi = 0;
        for(int d = 1; d < sz(s); d++) hi = max(hi, (.0 + cgood[ch][d]) / (ccc[ch]));
        P += pp * hi;
    }
    cout.precision(9);
    cout << fixed << P;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define vd vector<double>
#define PI acos(-1)
#define pub push_back
#define pob pop_back
#define mp make_pair
#define mmax(a, b, c) max(a, max(b, c))
#define mmin(a, b, c) min(a, min(b, c))
#define forup(i, a, b) for(int i = a; i <= b; ++i)
#define fordown(i, a, b) for(int i = a; i >= b; --i)

const int N = 1005000;
const int MAXN = 1e9 + 7;
const ll L = 1e12;
const ll MAXL = 1e18 + 9;
const double eps = 1e-11;
const ll base1 = 61;
const ll base2 = 97;
const ll mod1 = 1000001137;
const ll mod2 = 1000500013;

struct Point {
    ll x, y;
    Point (ll a, ll b) {
        x = a;
        y = b;
    }
    Point operator +(Point p) const{
        Point ans(x + p.x, y + p.y);
    }
    Point operator -(Point p) const{
        Point ans(x - p.x, y - p.y);
    }
    ll operator *(Point p) const{
        return (x * p.x + y * p.y);
    }
    ll operator &(Point p) const{
        return (x * p.y - y * p.x);
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int len = int(s.size());
    s += s;
    vector<int> cnt(26);
    vector<int> v(2 * len + 10);
    for (int i = 0; i < s.size(); ++i) {
        v[i] = int(s[i] - 'a');
        cnt[v[i]]++;
    }
    for (int i = 0; i < 26; ++i) {
        cnt[i] /= 2;
    }
    vector<vector<vector<int> > > after(26, vector<vector<int> > (len,  vector<int> (26)));
    for (int i = 0; i < len; ++i) {
        for (int l = 1; l < len; ++l) {
            int pos = i + l;
            after[v[i]][l][v[pos]]++;
        }
    }
    /*for (int i = 0; i < 26; ++i) {
        if (cnt[i]) {
            cout << char(i + 'a') << " " << cnt[i] << "\n";
            for (int l = 0; l < len; ++l) {
                cout << l << " : ";
                 for (int a = 0; a < 26; ++a) {
                    if (after[i][l][a]) {
                        cout << char(a + 'a') << "(" << after[i][l][a] << ") ";
                    }
                 }
                 cout << "\n";
            }
            cout << "\n";
        }
    }
    cout << "\n";*/
    double ans = 0;
    for (int i = 0; i < 26; ++i) {
        int have = cnt[i];
        bool was = false;
        double add = 0;
        for (int j = 1; j < len; ++j) {
            bool bug = false;
            for (int k = 0; k < 26; ++k) {
                if (after[i][j][k] > 1) {
                    bug = true;
                }
                if (after[i][j][k] == 1) {
                    was = true;
                }
            }
            if (!bug) {
                    //cout << char(i + 'a') << "(" << have << ") ";
                add += double(have);
                break;
            }
        }
        if (add == 0 && was) {
            ans++;
        }
        ans += add;
    }
    ans = ans / double(len);
    cout << setprecision(8) << fixed << ans << "\n";
    return 0;
}
/*
technocup

bbaabaabbb

tictictactac
*/


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define vd vector<double>
#define PI acos(-1)
#define pub push_back
#define pob pop_back
#define mp make_pair
#define mmax(a, b, c) max(a, max(b, c))
#define mmin(a, b, c) min(a, min(b, c))
#define forup(i, a, b) for(int i = a; i <= b; ++i)
#define fordown(i, a, b) for(int i = a; i >= b; --i)

const int N = 1005000;
const int MAXN = 1e9 + 7;
const ll L = 1e12;
const ll MAXL = 1e18 + 9;
const double eps = 1e-11;
const ll base1 = 61;
const ll base2 = 97;
const ll mod1 = 1000001137;
const ll mod2 = 1000500013;

struct Point {
    ll x, y;
    Point (ll a, ll b) {
        x = a;
        y = b;
    }
    Point operator +(Point p) const{
        Point ans(x + p.x, y + p.y);
    }
    Point operator -(Point p) const{
        Point ans(x - p.x, y - p.y);
    }
    ll operator *(Point p) const{
        return (x * p.x + y * p.y);
    }
    ll operator &(Point p) const{
        return (x * p.y - y * p.x);
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int len = int(s.size());
    s += s;
    vector<int> cnt(26);
    vector<int> v(2 * len + 10);
    for (int i = 0; i < s.size(); ++i) {
        v[i] = int(s[i] - 'a');
        cnt[v[i]]++;
    }
    for (int i = 0; i < 26; ++i) {
        cnt[i] /= 2;
    }
    vector<vector<vector<int> > > after(26, vector<vector<int> > (len,  vector<int> (26)));
    for (int i = 0; i < len; ++i) {
        for (int l = 1; l < len; ++l) {
            int pos = i + l;
            after[v[i]][l][v[pos]]++;
        }
    }
    /*for (int i = 0; i < 26; ++i) {
        if (cnt[i]) {
            cout << char(i + 'a') << " " << cnt[i] << "\n";
            for (int l = 0; l < len; ++l) {
                cout << l << " : ";
                 for (int a = 0; a < 26; ++a) {
                    if (after[i][l][a]) {
                        cout << char(a + 'a') << "(" << after[i][l][a] << ") ";
                    }
                 }
                 cout << "\n";
            }
            cout << "\n";
        }
    }
    cout << "\n";*/
    double ans = 0;
    for (int i = 0; i < 26; ++i) {
        int have = cnt[i];
        if (have == 0) continue;
        int dif = 0;
        double add = 0;
        for (int j = 1; j < len; ++j) {
            bool bug = false;
            int was = 0;
            for (int k = 0; k < 26; ++k) {
                if (after[i][j][k] > 1) {
                    bug = true;
                }
                if (after[i][j][k] == 1) {
                    was++;
                }
            }
            dif = max(dif, was);
            if (!bug) {
                    //cout << char(i + 'a') << "(" << have << ") ";
                add += double(have);
                break;
            }
        }
        if (add == 0 && dif) {
            ans += dif;
        }
        ans += add;
        //cout << char(i + 'a') << ans << "\n";
    }
    ans = ans / double(len);
    cout << setprecision(8) << fixed << ans << "\n";
    return 0;
}
/*
technocup

bbaabaabbb

tictictactac
*/


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

int INF = 1000000000;
signed main()
{
    string s;
    cin >> s;
    int n = s.size();
    map<int, vector<map<int, int>>> podch;
    map<int, int> countb;
    map<int, int> mini;
    for (int i = 0; i < n; i++)
    {
        countb[s[i]] += 1;
        if (podch[s[i]].size() == 0)
        {
            podch[s[i]].resize(n);
        }
        for (int j = 0; j < n; j++)
        {
            podch[s[i]][j][s[(i + j) % n]]++;
        }
    }
    for (auto i = podch.begin(); i != podch.end(); i++)
    {
        int mini1 = 0;
        for (int j = 0; j < n; j++)
        {
            int tempans = 0;
            for (auto k = (i -> second)[j].begin(); k != (i -> second)[j].end(); k++)
            {
                if (k -> second == 1)
                {
                    tempans++;
                }
            }
            mini1 = max(mini1, tempans);
        }
        mini[i->first] = mini1;
    }
    long double maxver = 0;
    for (int i = 0; i < n; i++)
    {
        maxver += (long double)mini[s[i]] / countb[s[i]];
    }
    cout.precision(10);
    cout << maxver / n << endl;
}


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

int INF = 1000000000;
signed main()
{
    string s;
    cin >> s;
    int n = s.size();
    unordered_map<int, vector<unordered_map<int, int>>> podch;
    unordered_map<int, int> countb;
    unordered_map<int, int> mini;
    for (int i = 0; i < n; i++)
    {
        countb[s[i]] += 1;
        if (podch[s[i]].size() == 0)
        {
            podch[s[i]].resize(n);
        }
        for (int j = 0; j < n; j++)
        {
            podch[s[i]][j][s[(i + j) % n]]++;
        }
    }
    for (auto i = podch.begin(); i != podch.end(); i++)
    {
        int mini1 = 0;
        for (int j = 0; j < n; j++)
        {
            int tempans = 0;
            for (auto k = (i -> second)[j].begin(); k != (i -> second)[j].end(); k++)
            {
                if (k -> second == 1)
                {
                    tempans++;
                }
            }
            mini1 = max(mini1, tempans);
        }
        mini[i->first] = mini1;
    }
    long double maxver = 0;
    for (int i = 0; i < n; i++)
    {
        maxver += (long double)mini[s[i]] / countb[s[i]];
    }
    cout.precision(10);
    cout << maxver / n << endl;
}


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

signed main()
{
    string s;
    cin >> s;
    int n = s.size();
    int maxver = 0;
    for (int i = 0; i < n; i++)
    {
        int ver = 0;
        map<pair<int, int>, int> mapka;
        for (int j = 0; j < n; j++)
        {
            mapka[make_pair(s[j], s[(j + i) % n])]++;
        }
        for (auto i = mapka.begin(); i != mapka.end(); i++)
        {
            if (i -> second == 1)
            {
                ver++;
            }
        }
        maxver = max(maxver, ver);
    }
    cout.precision(10);
    cout << (long double)maxver / n << endl;
}


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

int INF = 1000000000;
signed main()
{
    string s;
    cin >> s;
    int n = s.size();
    vector<vector<vector<int>>> podch(26);
    unordered_map<int, int> countb;
    unordered_map<int, int> mini;
    for (int i = 0; i < n; i++)
    {
        countb[s[i]] += 1;
        if (podch[s[i] - 'a'].size() == 0)
        {
            podch[s[i] - 'a'].resize(n);
        }
        for (int j = 0; j < n; j++)
        {
            if (podch[s[i] - 'a'][j].size() == 0)
                podch[s[i] - 'a'][j].resize(26);
            podch[s[i] - 'a'][j][s[(i + j) % n] - 'a']++;
        }
    }
    for (int i = 0; i < 26; i++)
    {
        if (podch[i].size() == 0)
        {
            continue;
        }

        int mini1 = 0;
        for (int j = 0; j < n; j++)
        {
            int tempans = 0;
            for (auto k = podch[i][j].begin(); k != podch[i][j].end(); k++)
            {
                if (*k == 1)
                {
                    tempans++;
                }
            }
            mini1 = max(mini1, tempans);
        }
        mini[i + 'a'] = mini1;
    }
    long double maxver = 0;
    for (int i = 0; i < n; i++)
    {
        maxver += (long double)mini[s[i]] / countb[s[i]];
    }
    cout.precision(10);
    cout << maxver / n << endl;
}


#include "bits/stdc++.h"
#define int long long
#define double long double
#pragma GCC optimize("O3")

using namespace std;

const int MAXN = 1e5 + 100;

signed main() {
    string s;
    cin >> s;
    vector<int> c(26);
    for (auto i : s)
        c[i - 'a']++;
    int n = s.size();
    s += s;

    vector<vector<vector<int>>> cnt(26);
    for (auto &i : cnt) {
        i.resize(n);
        for (auto &j : i)
            j.resize(26);
    }

    for (int i = 0; i < n; ++i) {
        for (int k = 1; k < n; ++k) {
            cnt[s[i] - 'a'][k][s[i + k] - 'a']++;
        }
    }

    double best_an = 0;
    for (int i = 0; i < 26; ++i) {
        double temp = 0, an = 0;
        for (int j = 1; j < n; ++j) {
            temp = 0;
            for(int k = 0; k < 26; ++k) {
                if (cnt[i][j][k] == 1) {
                    ++temp;
                }
            }
            an = max(an, temp);
        }
        best_an += an;
    }

    cout << setprecision(10) << fixed << (best_an / n) << endl;

    return 0;
}


#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define x first
#define y second
#define pb push_back
#define int long long
typedef long double ld;
char s[5000];
vector<char> shifts[5000];
bool cmp(vector<char> &a, vector<char> &b) {
	for (int i = 0; i < a.size(); ++i) {
		if (a[i] > b[i])
			return 0;
		else if (a[i] < b[i])
			return 1;
	}
	return 0;
}
void print(vector<char> &a) {
	for (int i = 0; i < a.size(); ++i)
		cout << a[i];
	cout << "\n";
}
int cnt[26];
ld calc(int a, int b, int p) {
	for (int i = 0; i < 26; ++i)
		cnt[i] = 0;
	ld ans = 0;
	for (int i = a; i <= b; ++i)
		++cnt[shifts[i][p] - 'a'];
	for (int i = 0; i < 26; ++i)
	    if (cnt[i] == 1)
		    ans += 1;
	return ans;
}
void solve() {
	gets(s);
	int n = strlen(s);
	for (int k = 0; k < n; ++k) {
		shifts[k].resize(n);
		for (int i = 0; i < n; ++i)
			shifts[k][i] = s[(i + k) % n];
	}
	sort(shifts, shifts + n, cmp);
	//for (int i = 0; i < n; ++i)
    //    print(shifts[i]);
	ld ans = 0;
	for (int i = 0; i < n; ++i) {
		int p = i;
		while (p < n && shifts[i][0] == shifts[p][0])
			++p;
		--p;
		ld mx = 0;
		for (int j = 0; j < n; ++j)
			mx = max(mx, calc(i, p, j));
		ans += mx / n;
		i = p;
	}
	cout << ans;
}
signed main() {
	//freopen("A.in", "r", stdin);
	//freopen("A.out", "w", stdout);
	ios_base::sync_with_stdio(false);
    cout.precision(40);
	solve();

	return 0;
}


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

signed main() {
    /*ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);*/
    string s;
    cin >> s;
    int n = s.size();
    s = s + s;
    vector<vector<int> > dan(27);
    for(int i = 0; i < n; i++) {
        dan[s[i] - 'a'].push_back(i);
    }
    int ans = 0;
    for(int i = 0; i < 27; i++) {
        if(dan[i].size() == 0) {
            continue;
        }
        if(dan[i].size() == 1) {
            ans++;
            continue;
        }
        int maxx = 0 ,tmp = 0;
        for(int j = 1; j < n; j++) {
            vector<int> ch(27, 0);
            tmp = 0;
            for(int z = 0; z < dan[i].size(); z++) {
                if(ch[s[dan[i][z] + j] - 'a']) {
                    ch[s[dan[i][z] + j] - 'a'] = -1;
                } else if(ch[s[dan[i][z] + j] - 'a'] != -1){
                    ch[s[dan[i][z] + j] - 'a'] = 1;
                }
            }
            for(int i = 0; i < 27; i++) {
                if(ch[i] == 1) {
                    tmp++;
                }
            }
            maxx = max(tmp, maxx);
        }
        ans += maxx;
    }
    cout << fixed;
    cout << setprecision(7);
    long double otv = n;
    otv = ans / otv;
    cout << otv;
    return 0;
}


#include <bits/stdc++.h>

//#define int long long

using namespace std;

signed main()
{
    string s;
    cin >> s;
    set < int > b;
    int vict = 0, n = int(s.size()), wrong, bestc = 0;
    vector < vector < int > > alf(26);
    vector < bool > check(26, false);
    for(int c = 0; c < n; c++)
        alf[s[c] - 'a'].push_back(c);
    for(auto c : alf)
    {
        bestc = 0;
        for(int dif = 1; dif < n; dif++)
        {
            check.assign(26, false);
            b.clear();
            wrong = 0;
            for(auto i : c)
            {
                if(!b.count(s[(i + dif) % n] - 'a'))
                    b.insert(s[(i + dif) % n] - 'a');
                else if(!check[s[(i + dif) % n] - 'a'])
                {
                    wrong++;
                    check[s[(i + dif) % n] - 'a'] = true;
                }
            }
            bestc = max(bestc, int(b.size()) - wrong);
        }
        vict += bestc;
    }
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(15);
    cout << double(vict) / n;
    return 0;
}


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

using namespace std;

#define forn(n) for(int i = 0; i < (n); ++i)
#define fornm(n, m) for(int i = 0; i < (n); ++i) for(int j = 0; j < (m); ++j)

typedef long long ll;
typedef long double ld;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;

const int MSIZE = 1e5;
const double EPS = 1e-9;
const double PI = acos(-1);
const ll INF = 1e18;

void solve(){
    string s;
    cin >> s;
    vector<vector<vector<int> > > mp(27, vector<vector<int> > (27, vector<int> (s.length() + 1, 0)));
    for (int i = 0; i < s.length(); ++i)
        for (int j = 0; j < s.length(); ++j){
            if (i != j){
                int dist = (j - i + s.length()) % s.length();
                mp[s[i] - 'a'][s[j] - 'a'][dist]++;
            }
        }
    ll allwin = 0, allgame = 0;
    for (char c = 0; c <= 26; ++c){
        ll bestwin = 0, bestall = 0;
        for (int dist = 1; dist < s.length(); ++dist){
            ll win = 0, all = 0;
            for (char d = 0; d <= 26; ++d){
                int k = mp[c][d][dist];
                if (k == 1)
                    win += k;
                all += k;
            }
            if (bestall == 0)
                bestwin = win, bestall = all;
            else if (bestwin * all < bestall * win) {
                bestwin = win;
                bestall = all;
            }
        }
        allwin += bestwin;
        allgame += bestall;
    }
    double res = (double) allwin / allgame;
    cout << fixed << setprecision(9) << res;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
#endif
    solve();
#ifndef ONLINE_JUDGE
    //cerr << fixed << setprecision(6) << (ld)clock() / CLOCKS_PER_SEC << '\n';
#endif
    return 0;
}


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

using namespace std;

#define forn(n) for(int i = 0; i < (n); ++i)
#define fornm(n, m) for(int i = 0; i < (n); ++i) for(int j = 0; j < (m); ++j)

typedef long long ll;
typedef long double ld;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;

const int MSIZE = 1e5;
const double EPS = 1e-9;
const double PI = acos(-1);
const ll INF = 1e18;

void solve(){
    string s;
    cin >> s;
    map<pair<pair<char, char>, int>, int> mp;

    for (int i = 0; i < s.length(); ++i)
        for (int j = 0; j < s.length(); ++j){
            if (i != j){
                int dist = (j - i + s.length()) % s.length();
                mp[{{s[i], s[j]}, dist}]++;
            }
        }

    ll allwin = 0, allgame = 0;
    for (char c = 'a'; c <= 'z'; ++c){
        ll bestwin = 0, bestall = 0;
        for (int dist = 1; dist < s.length(); ++dist){
            ll win = 0, all = 0;
            for (char d = 'a'; d <= 'z'; ++d){
                int k = mp[{{c, d}, dist}];
                if (k == 1)
                    win += k;
                all += k;
            }
            if (bestall == 0)
                bestwin = win, bestall = all;
            else if (bestwin * all < bestall * win) {
                bestwin = win;
                bestall = all;
            }
        }
        allwin += bestwin;
        allgame += bestall;
    }
    double res = (double) allwin / allgame;
    cout << fixed << setprecision(9) << res;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
#endif
    solve();
#ifndef ONLINE_JUDGE
    //cerr << fixed << setprecision(6) << (ld)clock() / CLOCKS_PER_SEC << '\n';
#endif
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <string>
using namespace std;

int main(){
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    string s;
    cin>>s;
    int n = s.size(), ca = (int)('a');
    vector<vector<int> > st(26);
    int j, i;
    for (i = 0 ; i < n; i++){
        st[s[i] - ca].push_back(i);
    }
    int k;
    float p2, ans = 0, mx;
    map<char, int> temp;
    for (i = ca; i<ca + 26; i++){
        temp[i] = 0;
    }
    for (i = 0; i < 26; i++){
        if (st[i].size()==0)
            continue;
        mx = 0;
        for ( j = 1; j< n; j++){
            p2 = 0;
            for (k = 0; k < st[i].size(); k++){
                temp[s[(st[i][k] + j)%n]]++;
            }
            for (k = ca; k<ca + 26; k++){
                if (temp[k]==1)
                    p2++;
                temp[k] = 0;
            }
            mx = max(mx, p2);
        }
        ans+=mx;
    }
    printf("%.6f", ans / n);
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <string>
using namespace std;

int main(){
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    string s;
    cin>>s;
    int n = s.size(), ca = (int)('a');
    vector<vector<int> > st(26);
    int j, i;
    for (i = 0 ; i < n; i++){
        st[s[i] - ca].push_back(i);
    }
    int k;
    double p2, ans = 0, mx;
    map<char, int> temp;
    for (i = ca; i<ca + 26; i++){
        temp[i] = 0;
    }
    for (i = 0; i < 26; i++){
        if (st[i].size()>26)
            continue;
        if (st[i].size()==0)
            continue;
        mx = 0;
        for ( j = 1; j< n; j++){
            p2 = 0;
            for (k = 0; k < st[i].size(); k++){
                temp[s[(st[i][k] + j)%n]]++;
            }
            for (k = ca; k<ca + 26; k++){
                if (temp[k]==1)
                    p2++;
                temp[k] = 0;
            }
            mx = max(mx, p2);
        }
        ans+=mx;
    }
    printf("%.6f", ans / n);
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <string>
using namespace std;

int main(){
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    string s;
    cin>>s;
    int n = s.size(), ca = (int)('a');
    vector<vector<int> > st(26);
    int j, i;
    for (i = 0 ; i < n; i++){
        st[s[i] - ca].push_back(i);
    }
    int k;
    float p2, ans = 0, mx;
    map<char, int> temp;
    for (i = ca; i<ca + 26; i++){
        temp[i] = 0;
    }
    for (i = 0; i < 26; i++){
        if (st[i].size()>26)
            continue;
        if (st[i].size()==0)
            continue;
        mx = 0;
        for ( j = 1; j< n; j++){
            p2 = 0;
            for (k = 0; k < st[i].size(); k++){
                temp[s[(st[i][k] + j)%n]]++;
            }
            for (k = ca; k<ca + 26; k++){
                if (temp[k]==1)
                    p2++;
                temp[k] = 0;
            }
            mx = max(mx, p2);
        }
        ans+=mx;
    }
    printf("%.6f", ans / n);
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <random>
#include <chrono>
#include <ctime>
#include <unordered_set>
#define ll long long
#define ld long double
using namespace std;
int inf = 1e9 + 7;

vector<int> f[26];

int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    //mt19937 rd(chrono::system_clock::now().time_since_epoch().count());
    ios::sync_with_stdio(0), cin.tie(0);

    string s;
    cin >> s;
    int i, j, k, n = s.size();
    for (i = 0; i < n; i++)
        f[s[i] - 'a'].emplace_back(i);

    int c[26], mx, tmp, ans = 0;
    for (i = 0; i < 26; i++){
        mx = 0;
        if (f[i].empty())
            continue;
        for (j = 1; j < n; j++){
            for (k = 0; k < 26; k++)
                c[k] = 0;
            for (int k : f[i])
                c[s[(k + j) % n] - 'a']++;
            tmp = 0;
            for (k = 0; k < 26; k++)
                if (c[k] == 1)
                    tmp++;
            mx = max(mx, tmp);
        }
        ans += mx;
    }

    cout << fixed << setprecision(6) << ans / (ld) n;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <string>
using namespace std;

int main(){
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    string s;
    cin>>s;
    int n = s.size(), ca = (int)('a');
    vector<vector<int> > st(26);
    vector<map<int, char> > mp(n);
    int j, i;
    for (i = 0 ; i < n; i++){
        st[s[i] - ca].push_back(i);
        for (j = 0; j<n; j++){
            if (i==j)
                continue;
            mp[(j - i + n)%n][i] = s[j];
        }
    }
    int k;
    double p2, ans = 0, mx;
    map<char, int> temp;
    for (i = ca; i<ca + 26; i++){
        temp[i] = 0;
    }
    for (i = 0; i < 26; i++){
        if (st[i].size()>26)
            continue;
        if (st[i].size()==0)
            continue;
        mx = 0;
        for ( j = 1; j< n; j++){
            p2 = 0;
            for (k = 0; k < st[i].size(); k++){
                temp[mp[j][st[i][k]]]++;
            }
            for (k = ca; k<ca + 26; k++){
                if (temp[k]==1)
                    p2++;
                temp[k] = 0;
            }
            mx = max(mx, p2);
        }
        ans+=mx;
    }
    printf("%.6f", ans / n);
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <bitset>

using namespace std;

struct pare {
	char a, b;
	int c;
};

bool operator <(const pare & a, const pare & b) {
	if (a.a != b.a)
		return a.a < b.a;
	if (a.b != b.b)
		return a.b < b.b;
	return a.c < b.c;
}
int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<vector<pare>> a(n, vector<pare>(n));
	for (int len = 0; len < n; ++len) {
		for (int i = 0; i < n; ++i) {
			int j = (i + len) % n;
			a[len][i] = { s[i], s[j], i };
		}
	}
	for (int i = 0; i < n; ++i)
		sort(a[i].begin(), a[i].end());
	bitset<5000> b;
	for (int len = 0; len < n; ++len)
		for (int i = 0; i < n; ++i) {
			if ((i == 0 || (a[len][i - 1].a != a[len][i].a || a[len][i - 1].b != a[len][i].b))
				&& (i == n - 1 || (a[len][i + 1].a != a[len][i].a || a[len][i + 1].b != a[len][i].b)))
				b[i] = 1;
		}
	int sum = 0;
	for (int i = 0; i < n; ++i)
		if (b[i])
			++sum;
	cout << (double)sum / (double)n;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <bitset>

using namespace std;

struct pare {
	char a, b;
	int c;
};

bool operator <(const pare & a, const pare & b) {
	if (a.a != b.a)
		return a.a < b.a;
	if (a.b != b.b)
		return a.b < b.b;
	return a.c < b.c;
}
int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<vector<pare>> a(n, vector<pare>(n));
	for (int len = 0; len < n; ++len) {
		for (int i = 0; i < n; ++i) {
			int j = (i + len) % n;
			a[len][i] = { s[i], s[j], i };
		}
	}
	for (int i = 0; i < n; ++i)
		sort(a[i].begin(), a[i].end());
	vector<int> b(26, 0);
	for (int len = 0; len < n; ++len) {
		vector<int> k(255);
		vector<vector<int>> k1(255, vector<int>(255, 0));
		for (int i = 0; i < n; ++i) {
			k[a[len][i].a]++;
			k1[a[len][i].a][a[len][i].b]++;
		}
		for (int i = 0; i < 26; ++i) {
			int ss = 0;
			for (int j = 0; j < 26; ++j)
				if (k1[i + 'a'][j + 'a'] == 1)
					++ss;
			b[i] = max(b[i], ss);
		}
	}
	long double sum = 0;
	for (int i = 0; i < 26; ++i)
		sum += b[i];
	cout << (double)sum / (double)n;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <bitset>

using namespace std;

struct pare {
	char a, b;
	int c;
};

bool operator <(const pare & a, const pare & b) {
	if (a.a != b.a)
		return a.a < b.a;
	if (a.b != b.b)
		return a.b < b.b;
	return a.c < b.c;
}
int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<vector<pare>> a(n, vector<pare>(n));
	for (int len = 0; len < n; ++len) {
		for (int i = 0; i < n; ++i) {
			int j = (i + len) % n;
			a[len][i] = { s[i], s[j], i };
		}
	}
	vector<int> b(26, 0);
	for (int len = 0; len < n; ++len) {
		vector<int> k(255);
		vector<vector<int>> k1(255, vector<int>(255, 0));
		for (int i = 0; i < n; ++i) {
			k[a[len][i].a]++;
			k1[a[len][i].a][a[len][i].b]++;
		}
		for (int i = 0; i < 26; ++i) {
			int ss = 0;
			for (int j = 0; j < 26; ++j)
				if (k1[i + 'a'][j + 'a'] == 1)
					++ss;
			b[i] = max(b[i], ss);
		}
	}
	long double sum = 0;
	for (int i = 0; i < 26; ++i)
		sum += b[i];
	cout << (double)sum / (double)n;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#define int int64_t
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define sz(v) ((int) (v).size())
#define all(v) (v).begin(), (v).end()
#define forn(i, j, n) for (int (i) = (j); (i) < (n); ++i)
#define forc(i, n, j) for (int (i) = (n) - (1); (i) >= (j); --i)
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <double> vd;
typedef vector <bool> vb;

const int C = 26, MAX = 5005;

int calc[MAX][C][C], dp[C];

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n = sz(s);
    s += s;
    string mass[n];
    forn(i, 0, n)
    {
        string cur = "";
        forn(j, i, i + n)
            cur += s[j];
        forn(j, 1, sz(cur))
            calc[j][cur[0] - 'a'][cur[j] - 'a']++;
        mass[i] = cur;
        dp[cur[0] - 'a']++;
    }
    double ans = 0.0;
    forn(c, 0, C)
    {
        double cur = 0.0;
        forn(i, 0, n)
        {
            int cnt1 = 0, cnt2 = 0;
            forn(k, 0, C)
            {
                cnt2 += calc[i][c][k];
                if (calc[i][c][k] == 1)
                    ++cnt1;
            }
            if (cnt2)
                cur = max(cur, (double) ((double) cnt1 / (double) cnt2));
        }
        ans += cur * dp[c];
    }
    ans /= n;
    cout << fixed << setprecision(20) << ans;
    return 0;
}


//{

#include <bits/stdc++.h>

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define mp make_pair
#define pii pair <int, int>
#define pb push_back

#define LOCAL

using namespace std;

using lli = long long;
using ld = long double;

//}

inline void Solve ()
{
    string data;
    cin >> data;
    vector <vector <int>> letters (26);
    for (int i = 0; i < data.size (); i++)
        letters[data[i] - 'a'].push_back (i);
    double result = 0;
    for (int i = 0; i < letters.size (); i++)
    {
        if (letters[i].empty ())
            continue;
        int p = 0;
        for (int j = 1; j < data.size (); j++)
        {
            vector <int> counter (3000);
            for (auto it : letters[i])
            {
                int index = (it + j) % data.size ();
                counter[10 * (data[it] - 'a') + (data[index] - 'a')]++;
            }
            int p1 = 0;
            for (auto it : counter)
            {
                if (it == 1)
                    p1++;
            }
            p = max (p, p1);
        }
        result += (double) (p) / (data.size ());
    }
    cout << result;
}

signed main ()
{
#ifndef LOCAL
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
#endif
    cout << fixed << setprecision (6);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

lli p = 0, q = 1;

void Generate (string& data, lli j)
{
    vector <lli> counter (1e4);
    for (lli i = 0; i < data.size (); i++)
    {
        lli next = 100 * (data[i] - 'a') + (data[(i + j) % data.size ()] - 'a');
        counter[next]++;
    }
    lli p1 = 0, q1 = 0;
    for (auto it : counter)
    {
        if (it == 1)
            p1++;
        q1 += it;
    }
    if (p * q1 < p1 * q)
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    for (lli j = 1; j <= data.size () - 1; j++)
        Generate (data, j);
    double result = (double) p / q;
    cout << fixed << setprecision (6) << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define mp make_pair
#define pii pair <int, int>
#define pb push_back

#define LOCAL

using namespace std;

using lli = long long;
using ld = long double;

//}

int p = 0, q = 0;

void Check (string data, int j)
{
    vector <int> counter (10000);
    for (int i = 0; i < data.size (); i++)
    {
        int index = (i + j) % data.size ();
        counter[10 * (data[i] - 'a') + (data[index] - 'a')]++;
    }
    int p1 = 0, q1 = 0;
    for (auto it : counter)
    {
        if (it > 0)
            q1 += it;
        if (it == 1)
            p1++;
    }
    if (((p == 0) && (q == 0)) || (p1 * q > p * q1))
    {
        p = p1;
        q = q1;
    }
}

inline void Solve ()
{
    string data;
    cin >> data;
    for (int j = 1; j < data.size (); j++)
        Check (data, j);
    double result = (double) p / q;
    cout << result;
}

signed main ()
{
#ifndef LOCAL
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
#endif
    cout << fixed << setprecision (6);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

lli p = 0, q = 1;

int Mod (int a, int b)
{
    return (a % b + b) % b;
}
void Generate (string& data, lli j)
{
    map <string, lli> counter;
    for (lli i = 0; i < data.size (); i++)
    {
        string next;
        next.push_back (data[i]);
        next.push_back (data[Mod ((i - j), data.size ())]);
        counter[next]++;
    }
    lli p1 = 0, q1 = data.size ();
    for (auto it : counter)
    {
        if (it.second == 1)
            p1++;
    }
    if (((ld) p / q) < ((ld) p1 / q1))
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    for (lli j = 0; j <= data.size () - 1; j++)
        Generate (data, j);
    ld result = (ld) p / q;
    cout << fixed << setprecision (6) << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

lli p = 0, q = 1;

void Generate (string& data, lli j)
{
    map <string, lli> counter;
    for (lli i = 0; i < data.size (); i++)
    {
        string next;
        next.push_back (data[i]);
        next.push_back (data[(i + j) % data.size ()]);
        counter[next]++;
    }
    lli p1 = 0, q1 = data.size ();
    for (auto it : counter)
    {
        if (it.second == 1)
            p1++;
    }
    if (((ld) p / q) < ((ld) p1 / q1))
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    for (lli j = 0; j <= data.size () - 1; j++)
        Generate (data, j);
    ld result = (ld) p / q;
    cout << fixed << setprecision (6) << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

lli p = 0, q = 1;

int Mod (int a, int b)
{
    return (a % b + b) % b;
}
void Generate (string& data, lli j)
{
    map <string, lli> counter;
    for (lli i = 0; i < data.size (); i++)
    {
        string next;
        if (i + j < data.size ())
        {
        next.push_back (data[i]);
        next.push_back (data[(i + j)]);
        }
        else
        {
            int tmp = i + j - data.size ();
            next.push_back (data[i]);
        next.push_back (data[Mod (tmp, data.size ())]);
        }
        counter[next]++;
    }
    lli p1 = 0, q1 = data.size ();
    for (auto it : counter)
    {
        if (it.second == 1)
            p1++;
    }
    if (((ld) p / q) < ((ld) p1 / q1))
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    for (lli j = 0; j <= data.size () - 1; j++)
        Generate (data, j);
    ld result = (ld) p / q;
    cout << fixed << setprecision (6) << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

lli p = 0, q = 1;

int Mod (int a, int b)
{
    return (a % b + b) % b;
}
void Generate (string& data, lli j)
{
    map <string, lli> counter;
    for (lli i = 0; i < data.size (); i++)
    {
        string next;
        if (i + j < data.size ())
        {
        next.push_back (data[i]);
        next.push_back (data[(i + j)]);
        }
        else
        {
            int tmp = i + j - data.size ();
            next.push_back (data[i]);
        next.push_back (data[Mod (i - tmp, data.size ())]);
        }
        counter[next]++;
    }
    lli p1 = 0, q1 = data.size ();
    for (auto it : counter)
    {
        if (it.second == 1)
            p1++;
    }
    if (((ld) p / q) < ((ld) p1 / q1))
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    for (lli j = 0; j <= data.size () - 1; j++)
        Generate (data, j);
    ld result = (ld) p / q;
    cout << fixed << setprecision (6) << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

/*lli p = 0, q = 0;

void Simulate (string& data, char c)
{
    vector <lli> pos;
    for (lli i = 0; i < data.size (); i++)
        if (data[i] == c)
            pos.push_back (c);
    for (lli j = 1; j <= data.size () - 1; j++)
    {
        vector <lli> counter (26);
        lli used = 0, one = 0;
        for (auto it : pos)
        {
            char next = data[(it + j) % data.size ()];
            if (counter[next - 'a'] == 1)
            {
                one--;
            }
            else if (counter[next - 'a'] == 0)
            {
                used++;
                one++;
            }
            counter[next - 'a']++;
        }
        p += one;
        q += used;
    }
}*/

lli p = 1, q = 1e9;

void Generate (string& data, lli j)
{
    vector <lli> counter (2626 + 1);
    for (lli i = 0; i < data.size (); i++)
    {
        lli next = 100 * (data[i] - 'a') + (data[(i + j) % data.size ()] - 'a');
        counter[next]++;
    }
    lli p1 = 0, q1 = 0;
    for (auto it : counter)
    {
        if (it == 1)
            p1++;
        q1 += it;
    }
    if (p * q1 < p1 * q)
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    /*for (char c = 'a'; c <= 'z'; c++)
        Simulate (data, c);
    double result = (double) p / q;
    cout << result;*/
    for (lli j = 1; j <= data.size () - 1; j++)
        Generate (data, j);
    double result = (double) p / q;
    cout << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    cout << fixed << setprecision (6);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

lli p = 0, q = 1;

void Generate (string& data, lli j)
{
    map <string, lli> counter;
    for (lli i = 0; i < data.size (); i++)
    {
        string next;
        next.push_back (data[i]);
        next.push_back (data[(i + j) % data.size ()]);
        counter[next]++;
    }
    lli p1 = 0, q1 = 0;
    for (auto it : counter)
    {
        if (it.second == 1)
            p1++;
        q1 += it.second;
    }
    if (p * q1 < p1 * q)
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    for (lli j = 0; j <= data.size () - 1; j++)
        Generate (data, j);
    double result = (double) p / q;
    cout << fixed << setprecision (6) << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

/*lli p = 0, q = 0;

void Simulate (string& data, char c)
{
    vector <lli> pos;
    for (lli i = 0; i < data.size (); i++)
        if (data[i] == c)
            pos.push_back (c);
    for (lli j = 1; j <= data.size () - 1; j++)
    {
        vector <lli> counter (26);
        lli used = 0, one = 0;
        for (auto it : pos)
        {
            char next = data[(it + j) % data.size ()];
            if (counter[next - 'a'] == 1)
            {
                one--;
            }
            else if (counter[next - 'a'] == 0)
            {
                used++;
                one++;
            }
            counter[next - 'a']++;
        }
        p += one;
        q += used;
    }
}*/

lli p = 0, q = 1;

void Generate (string& data, lli j)
{
    vector <lli> counter (2626 + 1);
    for (lli i = 0; i < data.size (); i++)
    {
        lli next = 100 * (data[i] - 'a') + (data[(i + j) % data.size ()] - 'a');
        counter[next]++;
    }
    lli p1 = 0, q1 = 0;
    for (auto it : counter)
    {
        if (it == 1)
            p1++;
        q1 += it;
    }
    if (p * q1 < p1 * q)
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    /*for (char c = 'a'; c <= 'z'; c++)
        Simulate (data, c);
    double result = (double) p / q;
    cout << result;*/
    for (lli j = 1; j <= data.size () - 1; j++)
        Generate (data, j);
    double result = (double) p / q;
    cout << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    cout << fixed << setprecision (6);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

using namespace std;

#define forn(i, a, b) for (auto i = a; i <= b; i++)
#define pb push_back
#define mp make_pair
#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()
#define pii pair <lli, lli>

typedef long long lli;
typedef long double ld;

//}

lli p = 0, q = 1;

void Generate (string& data, lli j)
{
    map <string, lli> counter;
    for (lli i = 0; i < data.size (); i++)
    {
        string next;
        next.push_back (data[i]);
        next.push_back (data[(i + j) % data.size ()]);
        counter[next]++;
    }
    lli p1 = 0, q1 = data.size ();
    for (auto it : counter)
    {
        if (it.second == 1)
            p1++;
    }
    if (p * q1 < p1 * q)
    {
        p = p1;
        q = q1;
    }
}

void Solve ()
{
    string data;
    cin >> data;
    for (lli j = 0; j <= data.size () - 1; j++)
        Generate (data, j);
    ld result = (ld) p / q;
    cout << fixed << setprecision (6) << result;
}

signed main ()
{
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
    Solve ();
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;

//typedef tree<int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> order_tree;
//*X.find_by_order(1)
//	*x.order_of_key
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;

const int INF = 1000000000;
const int mod = 1000000007;

#define endl "\n"
#define mp make_pair

string str;
int n;
ld usedLet[26], chance[26], BTT[26];
vector <int> a;
vector <int> pos[26];
int used[26][5005][26];
pair <long double, long double> dp[26][5005];
set <int> let;
ld result = 0;

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

	cin >> str;

	n = str.size();

	for (int i = 0; i < str.size(); i++) {
        a.push_back(str[i] - 'a');
        pos[a[i]].push_back(i);
        let.insert(a[i]);
        usedLet[a[i]]++;
        BTT[a[i]]++;
	}

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

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

        /*ld mx = 0;

        for (int j = 0; j < n; j++) {
            for (int k = 0; k < 26; k++) {
                if (used[a[i][j][k] == 1)
                    dp[a[i]][j].first += 1;

                dp[a[i]][j].second += used[a[i]][j][k];
            }

            mx = max(mx, dp[a[i]][j].first / dp[a[i]][j].second);
            dp[a[i]][j] = mp(0, 0);
        }

        chance[a[i]] = max(chance[i], mx);*/
	}

	for (int i = 0; i < 26; i++) {
        ld mx = 0;

        for (int j = 0; j < n; j++) {
            for (int k = 0; k < 26; k++) {
                if (used[i][j][k] == 1)
                    dp[i][j].first += 1;

                dp[i][j].second += used[i][j][k];
            }

            mx = max(mx, dp[i][j].first / dp[i][j].second);
            dp[i][j] = mp(0, 0);
        }

        chance[i] = max(chance[i], mx);
	}

	for (char cur : let)
        result += chance[cur] * (BTT[cur] / n);

	cout.precision(6);

    cout << fixed << result << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<int> vec[26];
int m[26][6000][26];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; ++i) {
        vec[s[i] - 'a'].push_back(i);
        for (int delta = 0; delta < n; ++delta) {
            m[s[i] - 'a'][delta][s[(i + delta) % n] - 'a']++;
            m[s[(i + delta) % n] - 'a'][n - delta - 1][s[i] - 'a']++;
        }
    }
    int ans = 0;
    /*for (int i = 0; i < 26; ++i) {
        if (vec[i].empty()) continue;
        //cout << char('a' + i) << " : ";
        for (int j = 0; j < vec[i].size(); ++j) cout << vec[i][j] << " ";
        cout << endl;
    }*/
    for (int i = 0; i < 26; ++i) {
        for (int j = 0; j < vec[i].size(); ++j) {
            //bool flag = false;
            for (int delta = 0; delta < n; ++delta) {
                if (m[i][delta][s[(vec[i][j] + delta) % n] - 'a'] == 1) {
                    ans += 1;
                    //flag = true;
                    //cout << delta << " ";
                    break;
                }
            }
            //if (flag) cout << vec[i][j] << endl;
        }
    }
    cout << fixed << setprecision(7) << double(ans) / double(n) << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<int> vec[26];
int m[26][6000][26];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; ++i) {
        vec[s[i] - 'a'].push_back(i);
        m[s[i] - 'a'][0][s[i] - 'a']++;
        for (int delta = 1; delta < n; ++delta) {
            m[s[i] - 'a'][delta][s[(i + delta) % n] - 'a']++;
            m[s[(i + delta) % n] - 'a'][n - delta - 1][s[i] - 'a']++;
        }
    }
    int ans = 0;
    /*for (int i = 0; i < 26; ++i) {
        if (vec[i].empty()) continue;
        //cout << char('a' + i) << " : ";
        for (int j = 0; j < vec[i].size(); ++j) cout << vec[i][j] << " ";
        cout << endl;
    }*/
    for (int i = 0; i < 26; ++i) {
        for (int j = 0; j < vec[i].size(); ++j) {
            //bool flag = false;
            for (int delta = 0; delta < n; ++delta) {
                if (m[i][delta][s[(vec[i][j] + delta) % n] - 'a'] == 1) {
                    ans += 1;
                    //flag = true;
                    //cout << delta << " ";
                    break;
                }
            }
            //if (flag) cout << vec[i][j] << endl;
        }
    }
    cout << fixed << setprecision(7) << double(ans) / double(n) << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<int> vec[26];
int m[26][6000][26];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; ++i) {
        vec[s[i] - 'a'].push_back(i);
        for (int delta = 0; delta < n; ++delta) {
            m[s[i] - 'a'][delta][s[(i + delta) % n] - 'a']++;
        }
    }
    double ans = 0;
    for (int i = 0; i < 26; ++i) {
        int pl = 0;
        for (int delta = 0; delta < n; ++delta) {
            int k = 0;
            for (int c = 0; c < 26; ++c) {
                if (m[i][delta][c] == 1) {
                    k++;
                }
                pl = max(pl, k);
            }
        }
        ans += pl;
    }
    cout << fixed << setprecision(10) << double(ans) / double(n) << endl;
    return 0;
}


#include<bits/stdc++.h>
#include<chrono>
#include<random>
#define ll long long
#define int ll
#define INF 1e+18
#define EPS 1e-18
#define pi pair<int,int>
#define endl "\n"
using namespace std;

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int n, cnt = 0;
	string s;
	map<char, vector<int>> pos;

	cin >> s;
	n = s.size();
	s += s;

	for (int i = 0; i < n; i++) {
		pos[s[i]].push_back(i);
	}

	for (auto i : pos) {
		int mx = 0;
		for (int d = 1; d < n; d++) {
			map<char,int> temp;
			int uni = 0;

			for (auto j : i.second) {
				temp[s[j + d]]++;
			}

			for (auto j : temp) {
				if (j.second == 1) uni++;
			}

			mx = max(mx, uni);
		}
		cnt += mx;
	}

	cout << fixed << setprecision(10) << (double)cnt / n;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int inf = 1e9 + 9;
const int mod = 1e9 + 7;
const ld eps = 1e-7;
const ll linf = 1e18 + 1;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define scn second
#define it(v) v.begin(), v.end()

signed main()
{
    ios_base::sync_with_stdio(false);
    cout << setprecision(10) << fixed;
    string s;
    cin >> s;
    int n = s.size();
    vector<vector<string> > kek(26);
    for (int i = 0; i < n; i++)
    {
        string tmp;
        for (int j = i; j < n; j++)
        {
            tmp += s[j];
        }
        for (int j = 0; j < i; j++)
        {
            tmp += s[j];
        }
        kek[tmp[0] - 'a'].pb(tmp);
    }
    ld res = 0;
    for (int i = 0; i < 26; i++)
    {
        if (kek[i].empty())
        {
            continue;
        }
        int mx = 0;
        for (int j = 0; j < n; j++)
        {
            vi cnt(26);
            for (int u = 0; u < kek[i].size(); u++)
            {
                cnt[kek[i][u][j] - 'a']++;
            }
            int sas = 0;
            for (int u = 0; u < 26; u++)
            {
                if (cnt[u] == 1)
                {
                    sas++;
                }
            }
            mx = max(mx, sas);
        }
        res += (ld) mx / n;
    }
    cout << res;
}


#include <stdio.h>
#include <vector>

int main() {
	char s[5001];
	scanf("%s", s);
	int len;
	for (len = 0; s[len]; len++);
	std::vector<int> pos['z' - 'a' + 1];
	for (int i = 0; i < len; i++) {
		pos[s[i] - 'a'].push_back(i);
	}
	int _cnt = 0;
	for (int _ = 0; _ < 'z' - 'a' + 1; _++) {
		int cnt[len]['z' - 'a' + 1] = {};
		for (int i = 0; i < pos[_].size(); i++) {
			for (int j = 0; j < len; j++) {
				cnt[j][s[(j + len - pos[_][i]) % len] - 'a']++;
			}
		}
		int max = 0;
		for (int i = 0; i < len; i++) {
			int cnt1 = 0;
			for (int j = 0; j < 'z' - 'a' + 1; j++) {
				cnt1 += (cnt[i][j] == 1);
			}
			if (cnt1 > max) {
				max = cnt1;
			}
		}
		_cnt += max;
	}
	printf("%.10lf", ((double)_cnt)/((double)(len)));
	return 0;
}


#include <stdio.h>
#include <vector>

int main() {
	char s[5001];
	scanf("%s", s);
	int len;
	for (len = 0; s[len]; len++);
	std::vector<int> pos['z' - 'a' + 1];
	for (int i = 0; i < len; i++) {
		pos[s[i] - 'a'].push_back(i);
	}
	int _cnt = 0;
	int cnt[len]['z' - 'a' + 1] = {};
	for (int _ = 0; _ < 'z' - 'a' + 1; _++) {
		for (int i = 0; i < pos[_].size(); i++) {
			for (int j = 0; j < len; j++) {
				cnt[(j + len - pos[_][i]) % len][s[j] - 'a']++;
			}
		}
		int max = 0;
		for (int i = 0; i < len; i++) {
			int cnt1 = 0;
			for (int j = 0; j < 'z' - 'a' + 1; j++) {
				cnt1 += (cnt[i][j] == 1);
				cnt[i][j] = 0;
			}
			if (cnt1 > max) {
				max = cnt1;
			}
		}
		_cnt += max;
	}
	printf("%.15lf", (double)(((long double)_cnt)/((long double)(len))));
	return 0;
}


#include <stdio.h>
#include <vector>

int main() {
	char s[5001];
	scanf("%s", s);
	int len;
	for (len = 0; s[len]; len++);
	std::vector<int> pos['z' - 'a' + 1];
	for (int i = 0; i < len; i++) {
		pos[s[i] - 'a'].push_back(i);
	}
	int _cnt = 0;
	for (int _ = 0; _ < 'z' - 'a' + 1; _++) {
		int cnt[len]['z' - 'a' + 1] = {};
		for (int i = 0; i < pos[_].size(); i++) {
			for (int j = 0; j < len; j++) {
				cnt[j][s[(j + len - pos[_][i]) % len] - 'a']++;
			}
		}
		int max = 0;
		for (int i = 0; i < len; i++) {
			int cnt1 = 0;
			for (int j = 0; j < 'z' - 'a' + 1; j++) {
				cnt1 += (cnt[i][j] == 1);
			}
			if (cnt1 > max) {
				max = cnt1;
			}
		}
		_cnt += max;
	}
	printf("%.15lf", (double)(((long double)_cnt)/((long double)(len))));
	return 0;
}


#include <stdio.h>
#include <vector>

int main() {
	char s[5001];
	scanf("%s", s);
	int len;
	for (len = 0; s[len]; len++);
	std::vector<int> pos['z' - 'a' + 1];
	for (int i = 0; i < len; i++) {
		pos[s[i] - 'a'].push_back(i);
	}
	int _cnt = 0;
	for (int _ = 0; _ < 'z' - 'a' + 1; _++) {
		int cnt[len]['z' - 'a' + 1] = {};
		for (int i = 0; i < pos[_].size(); i++) {
			for (int j = 1; j < len; j++) {
				cnt[j][s[(j + len - pos[_][i]) % len] - 'a']++;
			}
		}
		int max = 0;
		for (int i = 1; i < len; i++) {
			int cnt1 = 0;
			for (int j = 0; j < 'z' - 'a' + 1; j++) {
				cnt1 += (cnt[i][j] == 1);
			}
			if (cnt1 > max) {
				max = cnt1;
			}
		}
		_cnt += max;
	}
	printf("%.10lf", ((double)_cnt)/((double)(len)));
	return 0;
}


// ta.cpp : Defines the entry point for the console application.
//

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

using namespace std;

int main()
{
	long long n;
	cout.precision(16);
	string s;
	cin >> s;
	string t = s + s;
	vector<vector<vector<long long> > > nums(26, vector<vector<long long> >(s.size(), vector<long long>(26, 0)));
	vector<long double> used(26, 0);
	for(long long i = 0; i < s.size(); i++)
	{
		used[t[i] - 'a']++;
		for(long long j = 1; j < s.size(); j++)
		{
			nums[t[i] - 'a'][j][t[j + i] - 'a']++;
		}
	}
	for(long long i = 0; i < 26; i++)
	{
		used[i] /= s.size();
	}
	long double poss = 0;
	for(long long i = 0; i < 26; i++)
	{
		long double maxn = 0;
		for(long long j = 1; j < s.size(); j++)
		{
			long double cur = 0, cnt = 0;
			for(long long k = 0; k < 26; k++)
			{
				cnt += nums[i][j][k];
				cur += nums[i][j][k] == 1;
			}
			maxn = max(maxn, cur / cnt);
		}
		poss += maxn * used[i];
	}
	cout << poss;
	cin >> n;
	return 0;
}


// This is NOT my code. This is merely a test to see if the system is working properly.
// My submissions repeatedly give "Denial of Judgement"

#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
string tail[6]={"lios","liala","etr","etra","initis","inites"};
int judge(string str){
    for(int i=0;i<6;i++){
        if(str.substr(max(0,(int)(str.size()-tail[i].size())))==tail[i])return i;
    }
    return -1;
}
int main(){
    string str;
    int male=0,now=0,error=0,get=0,n=0,type;
    while(cin>>str){
        n++;
        type=judge(str);
        if(type==-1)error=-1;
        else if(type&1)male|=1;
        else male|=2;
        if(type<now)error=1;
        now=type;
        if(now==2||now==3){
            get=1;
            now+=2;
        }
    }
    if(n==1&&type!=-1){
        cout<<"YES"<<endl;
        return 0;
    }
    if(male==3||error||get==0)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}


#include<cstdlib>
#include<iostream>
#include<string>
using namespace std;
typedef pair<int,int> ii;

string suf[3][2]= {
    {"lios","liala"},
    {"etr","etra"},
    {"initis","inites"}
};
bool ends(string a,string b) {
    return a.size()>=b.size() && a.substr(a.size()-b.size(),b.size())==b;
}
ii getsuf(string s) {
    for(int i=0;i<3;i++) {
        for(int j=0;j<2;j++) {
            if(ends(s,suf[i][j])) {
                return ii(i,j);
            }
        }
    }
    return ii(-1,-1);
}
void kill() {
    cout<<"NO";
    exit(0);
}
int main() {
    string s;
    bool f=false;
    int g=-1;
    while(cin>>s) {
        ii t=getsuf(s);
        if(t.first==-1) {
            kill();
        }
        if(g==-1) {
            g=t.second;
        } else {
            if(g!=t.second) {
                kill();
            }
        }
        if(f) {
            if(t.first!=2) {
                kill();
            }
        } else {
            if(t.first==2) {
                kill();
            } else if(t.first==1) {
                f=true;
            }
        }
    }
    cout<<"YES";
}


#include<cstdlib>
#include<iostream>
#include<sstream>
#include<string>
using namespace std;
typedef pair<int,int> ii;

string suf[3][2]={
        {"lios","liala"},
        {"etr","etra"},
        {"initis","inites"}
};
bool ends(string a,string b) {
        return a.size()>=b.size() && a.substr(a.size()-b.size(),b.size())==b;
}
ii getsuf(string s) {
        for(int i=0;i<3;i++) {
                for(int j=0;j<2;j++) {
                        if(ends(s,suf[i][j])) {
                                return ii(i,j);
                        }
                }
        }
        return ii(-1,-1);
}
void kill() {
        cout<<"NO";
        exit(0);
}
int main() {
        string ln;
        readline(cin,ln);
        stringstream in(ln);
        string s;
        bool f=false;
        int g=-1,c=0;
        while(in>>s) {
                ii t=getsuf(s);
                if(t.first==-1) {
                        kill();
                }
                if(g==-1) {
                        g=t.second;
                } else {
                        if(g!=t.second) {
                                kill();
                        }
                }
                if(f) {
                        if(t.first!=2) {
                                kill();
                        }
                } else {
                        if(t.first==2) {
                                kill();
                        } else if(t.first==1) {
                                f=true;
                        }
                }
                c++;
        }
        if(!f && c!=1) {
                kill();
        }
        cout<<"YES";
}


#include<iostream>
#include<string>

using namespace std;

bool end(string a,string b)
{
    return a.size() >= b.size() && a.substr(a.size() - b.size()) == b;
}

int get_gender(string s)
{
    if (end(s,"lios") || end(s,"etr") || end(s,"initis"))
        return 0;
    if (end(s,"etra") || end(s,"liala")  || end(s,"inites"))
        return 1;
    return -1;
}

int get_type(string s)
{
    if (end(s,"lios") || end(s,"liala"))
        return 0;
    if (end(s,"etr") || end(s,"etra"))
        return 1;
    if (end(s,"initis") || end(s,"inites"))
        return 2;
    return -1;
}

string arr[100001];

int main()
{
    int n = 0;
    while(cin>>arr[n])
        n++;
    bool bad = false;
    for (int i=0;i<n-1 && !bad;i++)
        if (get_gender(arr[i]) != get_gender(arr[i+1]))
            bad = true;
    if (bad)
    {
        cout<<"NO"<<endl;
        return 0;
    }

    int type,state = 0;
    for (int i=0;i<n && !bad;i++)
    {
        type = get_type(arr[i]);
        if (type == -1)
            bad = true;
        else if (state == 0)
        {
            if (type == 1)
                state = 1;
            if (type == 2)
                bad = true;
        }
        else if (state == 1)
        {
            if (type <= 1)
                bad = true;
            else
                state = 2;
        }
        else
        {
            if (type <= 1)
                bad = true;
        }
    }
    if (bad || state == 0)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<string>

using namespace std;

bool end(string a,string b)
{
    return a.size() >= b.size() && a.substr(a.size() - b.size()) == b;
}

bool get_gender(string s)
{
    if (end(s,"lios") || end(s,"etr") || end(s,"initis"))
        return 0;
    if (end(s,"etra") || end(s,"liala")  || end(s,"inites"))
        return 1;
    return -1;
}

int get_type(string s)
{
    if (end(s,"lios") || end(s,"liala"))
        return 0;
    if (end(s,"etr") || end(s,"etra"))
        return 1;
    if (end(s,"initis") || end(s,"inites"))
        return 2;
    return -1;
}

string arr[100001];

int main()
{
    int n = 0;
    while(cin>>arr[n])
        n++;
    bool bad = false;
    for (int i=0;i<n-1 && !bad;i++)
        if (get_gender(arr[i]) != get_gender(arr[i+1]))
            bad = true;
    if (bad)
    {
        cout<<"NO"<<endl;
        return 0;
    }

    int type,state = 0;
    for (int i=0;i<n && !bad;i++)
    {
        type = get_type(arr[i]);
        if (type == -1)
            bad = true;
        else if (state == 0)
        {
            if (type == 1)
                state = 1;
            if (type == 2)
                bad = true;
        }
        else if (state == 1)
        {
            if (type <= 1)
                bad = true;
            else
                state = 2;
        }
        else
        {
            if (type <= 1)
                bad = true;
        }
    }
    if (bad)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<string>

using namespace std;

bool end(string a,string b)
{
    return a.size() >= b.size() && a.substr(a.size() - b.size()) == b;
}

int get_gender(string s)
{
    if (end(s,"lios") || end(s,"etr") || end(s,"initis"))
        return 0;
    if (end(s,"etra") || end(s,"liala")  || end(s,"inites"))
        return 1;
    return -1;
}

int get_type(string s)
{
    if (end(s,"lios") || end(s,"liala"))
        return 0;
    if (end(s,"etr") || end(s,"etra"))
        return 1;
    if (end(s,"initis") || end(s,"inites"))
        return 2;
    return -1;
}

string arr[100001];

int main()
{
    int n = 0;
    while(cin>>arr[n])
        n++;
    if (n == 1)
    {
        if (get_gender(arr[0]) >= 0 && get_type(arr[0]) >= 0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
        return 0;
    }
    bool bad = false;
    for (int i=0;i<n-1 && !bad;i++)
        if (get_gender(arr[i]) != get_gender(arr[i+1]))
            bad = true;
    if (bad)
    {
        cout<<"NO"<<endl;
        return 0;
    }

    int type,state = 0;
    for (int i=0;i<n && !bad;i++)
    {
        type = get_type(arr[i]);
        if (type == -1)
            bad = true;
        else if (state == 0)
        {
            if (type == 1)
                state = 1;
            if (type == 2)
                bad = true;
        }
        else if (state == 1)
        {
            if (type <= 1)
                bad = true;
            else
                state = 2;
        }
        else
        {
            if (type <= 1)
                bad = true;
        }
    }
    if (bad || state == 0)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<string>

using namespace std;

bool end(string a,string b)
{
    return a.size() >= b.size() && a.substr(a.size() - b.size()) == b;
}

bool get_gender(string s)
{
    if (end(s,"lios") || end(s,"etr") || end(s,"initis"))
        return 0;
    if (end(s,"etra") || end(s,"liala")  || end(s,"inites"))
        return 1;
    return -1;
}

int get_type(string s)
{
    if (end(s,"lios") || end(s,"liala"))
        return 0;
    if (end(s,"etr") || end(s,"etra"))
        return 1;
    if (end(s,"initis") || end(s,"inites"))
        return 2;
    return -1;
}

string arr[100001];

int main()
{
    int n = 0;
    while(cin>>arr[n])
        n++;
    bool bad = false;
    for (int i=0;i<n-1 && !bad;i++)
        if (get_gender(arr[i]) != get_gender(arr[i+1]))
            bad = true;
    if (bad)
    {
        cout<<"NO"<<endl;
        return 0;
    }

    int type,state = 0;
    for (int i=0;i<n && !bad;i++)
    {
        type = get_type(arr[i]);
        if (type == -1)
            bad = true;
        else if (state == 0)
        {
            if (type == 1)
                state = 1;
            if (type == 2)
                bad = true;
        }
        else if (state == 1)
        {
            if (type <= 1)
                bad = true;
            else
                state = 2;
        }
        else
        {
            if (type <= 1)
                bad = true;
        }
    }
    if (bad || state == 0)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<string>

using namespace std;

bool end(string a,string b)
{
    return a.size() >= b.size() && a.substr(a.size() - b.size()) == b;
}

bool get_gender(string s)
{
    if (end(s,"lios") || end(s,"etr") || end(s,"initis"))
        return 0;
    if (end(s,"etra") || end(s,"liala")  || end(s,"inites"))
        return 1;
    return -1;
}

int get_type(string s)
{
    if (end(s,"lios") || end(s,"liala"))
        return 0;
    if (end(s,"etr") || end(s,"etra"))
        return 1;
    if (end(s,"initis") || end(s,"inites"))
        return 2;
    return -1;
}

string arr[100001];

int main()
{
    int n = 0;
    while(cin>>arr[n])
        n++;
    bool bad = false;
    for (int i=0;i<n-1 && !bad;i++)
        if (get_gender(arr[i]) != get_gender(arr[i+1]))
            bad = true;
    if (bad)
    {
        cout<<"NO"<<endl;
        return 0;
    }

    int type,state = 0;
    for (int i=0;i<n && !bad;i++)
    {
        type = get_type(arr[i]);
        if (type == -1)
            bad = true;
        else if (state == 0)
        {
            if (type == 1)
                state = 1;
            if (type == 2)
                bad = true;
        }
        else if (state == 1)
        {
            if (type <= 1)
                bad = true;
            else
                state = 2;
        }
        else
        {
            if (type <= 1)
                bad = true;
        }
    }
    if (bad || state != 2)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<string>

using namespace std;

bool end(string a,string b)
{
    return a.size() >= b.size() && a.substr(a.size() - b.size()) == b;
}

int get_gender(string s)
{
    if (end(s,"lios") || end(s,"etr") || end(s,"initis"))
        return 0;
    if (end(s,"etra") || end(s,"liala")  || end(s,"inites"))
        return 1;
    return -1;
}

int get_type(string s)
{
    if (end(s,"lios") || end(s,"liala"))
        return 0;
    if (end(s,"etr") || end(s,"etra"))
        return 1;
    if (end(s,"initis") || end(s,"inites"))
        return 2;
    return -1;
}

string arr[100001];

int main()
{
    int n = 0;
    while(cin>>arr[n])
        n++;
    if (n == 1)
    {
        if (get_gender(a[0]) >= 0 && get_type(a[0]) >= 0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
        return 0;
    }
    bool bad = false;
    for (int i=0;i<n-1 && !bad;i++)
        if (get_gender(arr[i]) != get_gender(arr[i+1]))
            bad = true;
    if (bad)
    {
        cout<<"NO"<<endl;
        return 0;
    }

    int type,state = 0;
    for (int i=0;i<n && !bad;i++)
    {
        type = get_type(arr[i]);
        if (type == -1)
            bad = true;
        else if (state == 0)
        {
            if (type == 1)
                state = 1;
            if (type == 2)
                bad = true;
        }
        else if (state == 1)
        {
            if (type <= 1)
                bad = true;
            else
                state = 2;
        }
        else
        {
            if (type <= 1)
                bad = true;
        }
    }
    if (bad || state == 0)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int> b;
int ans=0;
char m[200000];
string a[3][2];

void answer(string d)
{
	cout<<d<<endl;
	exit(0);
}
	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	    if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//���ȱȽ� �ַ��Ƚ�
	    return i*2+j;//����һ��ֵ �Ժ�ʹ��
	     answer("NO");
	    return -1;

	}

	int main()
 {
  while(cin>>m)
	c.push_back((string)m);
    a[0][0]="lios";
	a[0][1]="liala";
	a[1][0]="etr";
	a[1][1]="etra";
	a[2][0]="initis";
	a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);}
     	if(b.size()==1)
     	cout<<"YES"<<endl;//ֻ��һ������
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=(b[k+1]%2))
     answer("NO");

		for(int i=0;i<b.size();++i)
    {

	b[i]/=2;
	if(b[i]==1)
	ans++;//�����ʸ������м���

	if(ans>1)cout<<"NO"<<endl;
}
if(ans!=1) cout<<"NO"<<endl;

	for(int i=0;i<b.size()-1;++i)

		if(b[i]>b[i+1])
	//	{cout<<"NO"<<endl;}//adj n v ����˳���ж�
//		else cout<<"YES"<<endl;
//	}
    answer("NO");
	answer("YES");
		return 0;

	}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int> b;
char m[200000];
string a[3][2];

void answer(string d)
{
	cout<<d<<endl;
	exit(0);
}
	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	   { if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//���ȱȽ� �ַ��Ƚ�
	    return i*2+j;//����һ��ֵ �Ժ�ʹ��
	     answer("NO");
	    return -1;
	   }

	}

	int main()
 {  int ans=0;
  while(cin>>m)
	c.push_back((string)m);

a[0][0]="lios";a[0][1]="liala";a[1][0]="etr";
a[1][1]="etra";a[2][0]="initis";a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);}
     	if(b.size()==1)
     	cout<<"YES"<<endl;//ֻ��һ������
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=(b[k+1]%2))
     answer("NO");

		for(int i=0;i<b.size();++i)
    {
	b[i]/=2;
	if(b[i]==1)
	ans++;//�����ʸ������м���

	if(ans>1)cout<<"NO"<<endl;
}
if(ans!=1) cout<<"NO"<<endl;

	for(int i=0;i<b.size()-1;++i)

		if(b[i]>b[i+1])
	//	{cout<<"NO"<<endl;}//adj n v ����˳���ж�
//		else cout<<"YES"<<endl;
//	}
    answer("NO");
	answer("YES");
		return 0;

	}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int> b;
int ans=0;
char m[200000];
string a[3][2];

void answer(string s)
{
	cout<<s<<endl;
	exit(0);
}
	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	    if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//���ȱȽ� �ַ��Ƚ�
	    return i*2+j;//����һ��ֵ �Ժ�ʹ��
	   answer("NO");
	    return -1;

	}

	int main()
 {
  while(cin>>m)
	c.push_back((string)m);
    a[0][0]="lios";
	a[0][1]="liala";
	a[1][0]="etr";
	a[1][1]="etra";
	a[2][0]="initis";
	a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);}
     	if(b.size()==1)
     	answer("YES");//ֻ��һ������
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=(b[k+1]%2))
   answer("NO");

		for(int i=0;i<b.size();++i)
    {

	b[i]/=2;
	if(b[i]==1)
	ans++;//�����ʸ������м���

	if(ans>1)answer("NO");
}
if(ans!=1)answer("NO");

	for(int i=0;i<b.size()-1;++i)

		if(b[i]>b[i+1])
	//	{cout<<"NO"<<endl;}//adj n v ����˳���ж�
//		else cout<<"YES"<<endl;
//	}
  answer("NO");answer("YES");
		return 0;

	}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int>b;
char m[200000];
string a[3][2];
	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	    if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//���ȱȽ� �ַ��Ƚ�
	    return i*2+j;//����һ��ֵ �Ժ�ʹ��
	    else cout<<"NO"<<endl;
	    return -1;

	}

	int main()
 {  int ans=0;
  while(cin>>m)
	c.push_back((string)m);

a[0][0]="lios";a[0][1]="liala";a[1][0]="etr";
a[1][1]="etra";a[2][0]="initis";a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);
     	if(b.size()==1)
     	cout<<"YES"<<endl;//ֻ��һ������
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=b[k+1]%2)
     	cout<<"NO"<<endl;
	 }

		for(int i=0;i<c.size();++i)
    {
	b[i]=b[i]/2;
	if(b[i]==1)
	ans++;//�����ʸ������м���
	}
	if(ans==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	for(int i=0;i<b.size()-1;++i)
	{
		if(b[i]>b[i+1])
		cout<<"NO"<<endl;//adj n v ����˳���ж�
		else cout<<"YES"<<endl;
	}
		return 0;

	}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int> b;
char m[200000];
string a[3][2];

void answer(string d)
{
	cout<<d<<endl;
	exit(0);
}
	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	    if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//长度比较 字符比较
	    return i*2+j;//返回一个值 以后使用
	     answer("NO");
	    return -1;

	}

	int main()
 {  int ans=0;
  while(cin>>m)
	c.push_back((string)m);

a[0][0]="lios";a[0][1]="liala";a[1][0]="etr";
a[1][1]="etra";a[2][0]="initis";a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);}
     	if(b.size()==1)
     	cout<<"YES"<<endl;//只有一个单词
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=(b[k+1]%2))
     	cout<<"NO"<<endl;

		for(int i=0;i<c.size();++i)
    {
	b[i]/=2;
	if(b[i]==1)
	ans++;//对名词个数进行计数

	if(ans>1)cout<<"NO"<<endl;
}
if(ans!=1) cout<<"NO"<<endl;

	for(int i=0;i<b.size()-1;++i)

		if(b[i]>b[i+1])
	//	{cout<<"NO"<<endl;}//adj n v 词性顺序判断
//		else cout<<"YES"<<endl;
//	}
    answer("NO");
	answer("YES");
		return 0;

	}


//#include<iostream>
//#include<string>
//#include<vector>
#include<bits/stdc++.h>
using namespace std;
char z[100010];
int ans=0;
string end[3][2];
vector<string> a;
vector<int> b;
void answer(string s)
{
	cout<<s<<endl;
	exit(0);
}
int calc(string s)
{
	for(int i=0;i<3;i++)
	 for(int j=0;j<2;j++)
	 	if(s.size()>=end[i][j].size()&&s.substr(s.size()-end[i][j].size())==end[i][j])
	     return i*2+j;
	 answer("NO");
	 return -1;
}
int main()
{
	while(cin>>z)
	a.push_back((string)z);
	end[0][0]="lios";
	end[0][1]="liala";
	end[1][0]="etr";
	end[1][1]="etra";
	end[2][0]="initis";
	end[2][1]="inites";
	b.resize(a.size());
	for(int i=0;i<a.size();i++)
	b[i]=calc(a[i]);
	if(b.size()==1)
	answer("YES");
	for(int i=0;i<b.size()-1;i++)
	if((b[i]%2)!=(b[i+1]%2))
	answer("NO");
	for(int i=0;i<b.size();i++)
	{
		b[i]/=2;
		if(b[i]==1)
		ans++;
		if(ans>1)
		answer("NO");
	}
	if(ans!=1)
	answer("NO");
	for(int i=0;i<b.size()-1;i++)
	if(b[i]>b[i+1])
	answer("NO");
	answer("YES");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
char z[100010];
int ans=0;
string end[3][2];
vector<string> a;
vector<int> b;
void answer(string s)
{
	cout<<s<<endl;
	exit(0);
}
int calc(string s)
{
	for(int i=0;i<3;i++)
	 for(int j=0;j<2;j++)
	 	if(s.size()>=end[i][j].size()&&s.substr(s.size()-end[i][j].size())==end[i][j])
	     return i*2+j;
	 answer("NO");
	 return -1;
}
int main()
{
	while(cin>>z)
	a.push_back((string)z);
	end[0][0]="lios";
	end[0][1]="liala";
	end[1][0]="etr";
	end[1][1]="etra";
	end[2][0]="initis";
	end[2][1]="inites";
	b.resize(a.size());
	for(int i=0;i<a.size();i++)
	b[i]=calc(a[i]);
	if(b.size()==1)
	answer("YES");
	for(int i=0;i<b.size()-1;i++)
	if((b[i]%2)!=(b[i+1]%2))
	answer("NO");
	for(int i=0;i<b.size();i++)
	{
		b[i]/=2;
		if(b[i]==1)
		ans++;
		if(ans>1)
		answer("NO");
	}
	if(ans!=1)
	answer("NO");
	for(int i=0;i<b.size()-1;i++)
	if(b[i]>b[i+1])
	answer("NO");
	answer("YES");
	return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int>b;
char m[200000];
string a[3][2];
	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	    if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//���ȱȽ� �ַ��Ƚ�
	    return i*2+j;//����һ��ֵ �Ժ�ʹ��
	     cout<<"NO"<<endl;
	    return -1;

	}

	int main()
 {  int ans=0;
  while(cin>>m)
	c.push_back((string)m);

a[0][0]="lios";a[0][1]="liala";a[1][0]="etr";
a[1][1]="etra";a[2][0]="initis";a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);}
     	if(b.size()==1)
     	cout<<"YES"<<endl;//ֻ��һ������
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=(b[k+1]%2))
     	cout<<"NO"<<endl;

		for(int i=0;i<c.size();++i)
    {
	b[i]=b[i]/2;
	if(b[i]==1)
	ans++;//�����ʸ������м���

	if(ans>1)cout<<"NO"<<endl;
}
if(ans!=1) cout<<"NO"<<endl;

	for(int i=0;i<b.size()-1;++i)
	{
		if(b[i]>b[i+1])
		cout<<"NO"<<endl;//adj n v ����˳���ж�
		else cout<<"YES"<<endl;
	}
		return 0;

	}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int> b;
int ans=0;
char m[200000];
string a[3][2];

	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	    if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//���ȱȽ� �ַ��Ƚ�
	    return i*2+j;//����һ��ֵ �Ժ�ʹ��
	    cout<<"NO"<<endl; return 0;
	    return -1;

	}

	int main()
 {
  while(cin>>m)
	c.push_back((string)m);
    a[0][0]="lios";
	a[0][1]="liala";
	a[1][0]="etr";
	a[1][1]="etra";
	a[2][0]="initis";
	a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);}
     	if(b.size()==1)
     	cout<<"YES"<<endl; return 0;//ֻ��һ������
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=(b[k+1]%2))
    cout<<"NO"<<endl; return 0;

		for(int i=0;i<b.size();++i)
    {

	b[i]/=2;
	if(b[i]==1)
	ans++;//�����ʸ������м���

	if(ans>1)cout<<"NO"<<endl;	 return 0;
}
if(ans!=1) cout<<"NO"<<endl; return 0;

	for(int i=0;i<b.size()-1;++i)

		if(b[i]>b[i+1])
	//	{cout<<"NO"<<endl;}//adj n v ����˳���ж�
//		else cout<<"YES"<<endl;
//	}
   cout<<"NO"<<endl; return 0;
   cout<<"YES"<<endl; return 0;
		return 0;

	}


#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<bits/stdc++.h>
using namespace std;
vector<string> c;
vector<int>b;
char m[200000];
string a[3][2];

void answer(string d)
{
	cout<<d<<endl;
	exit(0);
}
	int pd(string s)
	{
		for(int i=0;i<3;++i)
		for(int j=0;j<2;++j)
	    if(s.size()>=a[i][j].size()&&s.substr(s.size()-a[i][j].size())==a[i][j])//���ȱȽ� �ַ��Ƚ�
	    return i*2+j;//����һ��ֵ �Ժ�ʹ��
	     cout<<"NO"<<endl;
	    return -1;

	}

	int main()
 {  int ans=0;
  while(cin>>m)
	c.push_back((string)m);

a[0][0]="lios";a[0][1]="liala";a[1][0]="etr";
a[1][1]="etra";a[2][0]="initis";a[2][1]="inites";

     b.resize(c.size());
     for(int j=0;j<c.size();++j)
     {
     	b[j]=pd(c[j]);}
     	if(b.size()==1)
     	cout<<"YES"<<endl;//ֻ��һ������
     	for(int k=0;k<b.size()-1;++k)
     	if((b[k]%2)!=(b[k+1]%2))
     	cout<<"NO"<<endl;

		for(int i=0;i<c.size();++i)
    {
	b[i]=b[i]/2;
	if(b[i]==1)
	ans++;//�����ʸ������м���

	if(ans>1)cout<<"NO"<<endl;
}
if(ans!=1) cout<<"NO"<<endl;

	for(int i=0;i<b.size()-1;++i)
	{
		if(b[i]>b[i+1])
	//	{cout<<"NO"<<endl;}//adj n v ����˳���ж�
//		else cout<<"YES"<<endl;
//	}
    answer("NO");
	answer("YES");}
		return 0;

	}