#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
using ping = pair<long long, long long>;
int main() {
  string S;
  cin >> S;
  long long idx = 1;
  long long out = 0;
  while (idx < S.size()) {
    long long cnt_a = 1;
    long long cnt_b = 1;
    for (idx;; idx++) {
      if (S[idx] == S[idx - 1])
        cnt_a++;
      else {
        idx++;
        break;
      }
    }
    for (idx;; idx++) {
      if (S[idx] == S[idx - 1])
        cnt_b++;
      else {
        idx++;
        break;
      }
    }
    out += min(cnt_a, cnt_b) * 2;
  }
  cout << out << endl;
  return 0;
}
