#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(11);
    string S;
    cin >> S;
    vector<char> s(S.size());
    for(int i = 0; i < S.size(); i++){
        s[i] = S[i];
    }

    ll ans = 0;
    int flag = 1;
    while(flag){ 
        flag = 0;
        for(int i = 0; i < s.size()-1; i++){
            if(s[i] != s[i+1]){
                ans += 2;
                flag = 1;
                s.erase(i, 2);
                break;
            }
        }
        
    }

    cout << ans << endl;
    return 0;
}
