#include <bits/stdc++.h>
using namespace std;
int replaceStr(string& base, const string source, const string target) {
  int count = 0;
  string::size_type pos(base.find(source));
  while (pos != string::npos) {
    count++;
    base.replace(pos, source.length(), target);
    pos = base.find(source, pos + target.length());
  }
  return count;
}
int main() {
  string S;
  cin >> S;
  int sum = 0;
  int zero_one = replaceStr(S, "01", "");
  int one_zero = replaceStr(S, "10", "");
  sum = zero_one + one_zero;
  while (zero_one + one_zero != 0) {
    zero_one = replaceStr(S, "01", "");
    one_zero = replaceStr(S, "10", "");
    sum += zero_one + one_zero;
  }
  cout << sum * 2 << endl;
  return 0;
}
