#include <bits/stdc++.h>
template <typename T>
using vec = std::vector<T>;
using vi = vec<int>;
using vvi = vec<vi>;
using pii = std::pair<int, int>;
using ll = long long;
using ld = long double;
using namespace std;
const int MOD = 1000000007;
template <typename T>
void putv(vector<T> &V) {
  for (auto x : V) cout << x << " ";
  cout << endl;
}
template <class T>
vector<T> getv(int n) {
  vector<T> vec;
  for (int i = (0); i < int(n); ++i) {
    T input;
    cin >> input;
    vec.emplace_back(input);
  }
  return vec;
}
using AdjList = vector<vector<int>>;
using Weight = int;
using Flow = int;
struct Edge {
  int src, dst;
  Weight weight;
  Flow cap;
  Edge() : src(0), dst(0), weight(0) {}
  Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;
void add_edge(Graph &g, int a, int b, Weight w = 1) {
  g[a].emplace_back(a, b, w);
  g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) {
  g[a].emplace_back(a, b, w);
}
AdjList getadj(int N, int M) {
  vector<int> init;
  vector<vector<int>> graph(N, init);
  for (int i = (0); i < int(M); ++i) {
    int a, b;
    cin >> a >> b;
    graph[a - 1].emplace_back(b - 1);
    graph[b - 1].emplace_back(a - 1);
  }
  return graph;
}
ll Manhattan_dist(ll x1, ll y1, ll x2, ll y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
void out(bool ans) {
  if (ans == true)
    cout << "yes" << endl;
  else
    cout << "no" << endl;
}
void Out(bool ans) {
  if (ans == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
void OUT(bool ans) {
  if (ans == true)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
ll gcd(const ll a, const ll b) { return (b == 0) ? a : gcd(b, a % b); }
ll lcm(const ll a, const ll b) { return a * (b / gcd(a, b)); }
ll hmt_p_divide_n(ll p, ll n) {
  ll s = 0;
  while (n % p == 0) {
    n /= p;
    s++;
  }
  return s;
}
int digit(ll n) {
  int cntr = 0;
  while (n > 0) {
    n /= 10;
    cntr++;
  }
  return cntr;
}
int main() {
  string s;
  cin >> s;
  int cntr = 0;
  int inner_cntr = 1;
  while (s.length() > 0 && inner_cntr > 0) {
    inner_cntr = 0;
    int i = 0;
    while (i < s.length() - 1) {
      if (s[i + 1] != s[i]) {
        inner_cntr++;
        s.erase(s.begin() + i);
        s.erase(s.begin() + i);
        if (s.length() == 0) break;
      } else
        i++;
    }
    cntr += inner_cntr;
  }
  cout << 2 * cntr << endl;
}
