class Unification:
    def __init__(self, cube: list):
        self.cube = cube

    def calc(self):
        ans = 0
        i = 0
        while i < len(self.cube) - 1:
            if self.cube[i] != '-' and self.cube[i] != self.cube[i + 1]:
                ans += 2
                self.erase(i)
                self.erase(i + 1)
            i += 1
        print(ans)

    def erase(self, i: int):
        drop_cube = i - 2
        if drop_cube < 0:
            self.cube[i] = '-'
        else:
            self.cube[i] = self.cube[drop_cube]
    

S = list(input())
S.reverse()
cube = Unification(S)
cube.calc()