import copy

if __name__ == "__main__":
    s = input()
    n = len(s)
    check = ""
    ans = 0 
    while s != check and s != "": 
        check = copy.copy(s)
        i = 0 
        while i + 1 < len(s) - 1 and s[i] == s[i + 1]: 
            i += 1
        if i == len(s) - 2:
            if s[i] != s[i + 1]: 
                s = copy.copy(s[0:i] + s[i + 1:len(s)])
                s = copy.copy(s[0:i] + s[i + 1:len(s)])
                ans += 2
            else:
                break
        elif i == 0 and len(s) <= 1:
            break
        else:
            s = copy.copy(s[0:i] + s[i + 1:len(s)])
            s = copy.copy(s[0:i] + s[i + 1:len(s)])
            ans += 2
    print(ans)