#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <unordered_map>
#include <vector>

// #include <atcoder/all>
/*
cd $dir && g++ -std=c++17 -Wall -Wextra -O2 -DATCODERDEBUG
-I/mnt/d/MyProjects/atcoder/lib/ac-library $fileName && echo 'compilation ok!'
&&  ./a.out
*/
using namespace std;
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define ALL(x) x.begin(), x.end()
#define dame(a)        \
  {                    \
    cout << a << endl; \
    return 0;          \
  }
typedef long long ll;

class dstream : public ostream {};

template <typename T>
dstream &operator<<(dstream &os, T v) {
#ifdef ATCODERDEBUG
  cout << "\033[1;31m" << v << "\033[0m";
#endif
  return os;
}

ostream &endd(std::ostream &out) {
#ifdef ATCODERDEBUG
  out << std::endl;
#endif
  return out;
}
dstream dout;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[ ";
  for (auto const &x : v) {
    os << x;
    if (&x != &v.back()) {
      os << " : ";
    }
  }
  os << " ]" << endl;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  os << "[" << endl;
  for (auto const &x : v) {
    os << " ";
    os << x;
  }
  os << "]" << endl;
  return os;
}

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {}) {
  if (comp(xmax, x)) {
    xmax = x;
    return true;
  }
  return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {}) {
  if (comp(x, xmin)) {
    xmin = x;
    return true;
  }
  return false;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  string s;
  cin >> s;
  ll cnt = 0;
  vector<ll> list;

  REP(i, s.size() - 1) {
    if (s[i + 1] == s[i])
      cnt++;
    else if (cnt > 0) {
      cnt = 0;
      list.emplace_back(i);
    }
  }
  dout << list << endd;
  ll ans = 0;

  vector<ll> tbl(26, 0);
  ll ct = s.size() - 1;
  for (ll i = list.size() - 1; i >= 0; i--) {
    ll idx = list[i];

    for (; ct > idx; ct--) {
      tbl[(s[ct] - 'a')]++;
    }
    ans += s.size() - idx - 1 - tbl[(s[idx] - 'a')];

    tbl = vector<ll>(26, 0);
    tbl[(s[idx] - 'a')] = s.size() - idx - 1;
  }
  cout << ans << endl;
  // cout << std::fixed << std::setprecision(15) << sqrt(ans) << endl;
}

#include<bits/stdc++.h>
using namespace std;
double n;
double ans;
int main()
{
    cin>>n;
    for(int i=1;i<n;i++){
        ans=ans+n/(n-i);
    }
    printf("%.10f\n",ans);
    system("pause");
    return 0;
}