#include #include #include using namespace std; // 575 int main() { string S; cin >> S; int use[26] = {}; int64_t sum = (int64_t)13 * S.size() * (S.size() + 1); for (int i = 0;i < S.size();++ i) for (int j = 0;j < 26;++ j) sum -= use[j] = S[i] == j + 'a' ? 0 : use[j] + 1; cout << setprecision(3) << fixed << sum * 2.0 / S.size() / (S.size() + 1) << endl; return 0; }