import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto S = readln.chomp;

    int x = 0;
    int cnt = 0;
    while (x+1 < S.length) {
        if (S[x] == S[x+1]) {
            x++;
        } else {
            S = S[0..x] ~ S[x+2..$];
            cnt += 2;
            x = max(x-1, 0);
        }
    }
    writeln(cnt);
}
