#include <bits/stdc++.h>
using namespace std;
inline void read(int &a) {
  a = 0;
  int c = getchar(), b = 1;
  while (c > '9' || c < '0') {
    if (c == '-') b = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') a = (a << 3) + (a << 1) + c - 48, c = getchar();
  a *= b;
}
inline int Rem() {
  int a = 0, c = getchar(), b = 1;
  while (c > '9' || c < '0') {
    if (c == '-') b = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') a = (a << 3) + (a << 1) + c - 48, c = getchar();
  return a *= b;
}
inline void write(int x) {
  if (x > 9) write(x / 10);
  putchar('0' + x % 10);
}
inline void W(int x) {
  if (x < 0) {
    putchar('-'), x = -x;
  }
  write(x);
}
string s;
int ans;
void dfs(string s, int num) {
  if ((s.find("01") == string::npos && s.find("10") == string::npos)) {
    ans = max(ans, num);
    return;
  }
  int len = s.length();
  for (int i = 0; i < len - 1; i++) {
    if (s[i] != s[i + 1]) {
      dfs(s.substr(0, i) + s.substr((i + 2), len - (i + 2)), num + 2);
      return;
    }
  }
}
int main() {
  cin >> s;
  dfs(s, 0);
  cout << ans;
  return 0;
}
