import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();

void main()
{
    auto stack = DList!long();
    auto s = sread();
    long cnt;
    foreach(e; s)
    {
        if(stack.empty || stack.back == e)
        {
            stack.insertBack(e);
        }
        else
        {
            cnt += 2;
            stack.removeBack();
        }
    }
    cnt.writeln();
}
