#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::string;
int main() {
  string ss;
  cin >> ss;
  std::vector<int> s;
  for (size_t i = 0; i < ss.size(); ++i) {
    std::string tmp = ss.substr(i, 1);
    s.emplace_back(std::stoi(tmp));
  }
  int count = 0;
  while (s.size() > 2) {
    int id = -1;
    for (size_t i = s.size(); i > 0; --i) {
      if (s[i] != s[i - 1]) {
        id = i;
        break;
      }
    }
    if (id != -1) {
      s.erase(s.begin() + id - 3, s.begin() + id - 1);
      count += 2;
    } else {
      break;
    }
  }
  std::cout << count << "\n";
  return 0;
}
