#include <bits/stdc++.h>
using namespace std;
using P = pair<long long int, long long int>;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
struct Edge {
  int to;
  long long int weight;
  Edge(int t, long long int w) : to(t), weight(w) {}
};
template <typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }
  for (int i = 0; i < v.size(); ++i) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}
string s;
bool seen[110000];
int main() {
  cin >> s;
  int n = s.size();
  int ans = 0;
  while (true) {
    bool flg = true;
    char tmp = ' ';
    int tmp_pos = 0;
    for (int i = 0; i < n; ++i) {
      if (seen[i]) continue;
      if (tmp != ' ' && tmp != s[i]) {
        seen[tmp_pos] = true;
        seen[i] = true;
        ans += 2;
        tmp = ' ';
        tmp_pos = 0;
        flg = false;
      } else {
        tmp = s[i];
        tmp_pos = i;
      }
    }
    if (flg) break;
  }
  cout << ans << "\n";
}
