// // Created by yamunaku on 2019/07/26. // #include using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) #define repl(i, l, r) for(int i = (l); i < (r); i++) #define per(i, n) for(int i = ((n)-1); i >= 0; i--) #define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--) #define all(x) (x).begin(),(x).end() #define MOD9 998244353 #define MOD1 1000000007 #define IINF 1000000000 #define LINF 1000000000000000000 #define SP <<" "<< #define CYES cout<<"Yes"< vi; typedef vector> mti; typedef vector vl; typedef vector> mtl; int main(){ string s; cin >> s; ld n=s.length(); vector> nx(26); rep(i,n){ nx[s[i]-'a'].push(i); } ld ans=0; rep(i,n){ rep(j,26){ if(!nx[j].empty()){ ans+=n-nx[j].front(); if(nx[j].front()==i) nx[j].pop(); } } } CST(10); cout << ans/(n*(n+1)/2) << endl; return 0; }