#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int ans = 0, i;
  cin >> s;
  for (i = 0; i < s.length() - 1; i++) {
    int j = i;
    while (s[i] == s[i + 1]) i++;
    int k = i - j, c;
    for (c = 1; c < k; c++) {
      k -= c;
    }
    ans += c;
  }
  if (s[i] != s[i - 1]) ans++;
  cout << ans << endl;
  return 0;
}
