import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    S = SS()

    ans = 0
    stk = []
    for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

    print(ans)

if __name__ == '__main__':
    resolve() import sys sys input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 INF = 10**20 INF 10**20 10 20 def I(): return int(input()) I def F(): return float(input()) F def SS(): return input() SS int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x def LI(): return [int(x) for x in input().split()] LI int(x)-1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in input().split()] LI_ float(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() float(x) float x def LF(): return [float(x) for x in input().split()] LF def LS(): return input().split() LS def resolve():
    S = SS()

    ans = 0
    stk = []
    for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

    print(ans) resolve S = SS() S SS() SS ans = 0 ans 0 stk = [] stk [] for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

     i S if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

     stk and stk[-1] != i stk stk[-1] != i stk[-1] stk -1 i stk.pop() stk.pop stk pop ans += 2 ans 2 stk.append(i) stk.append stk append i print(ans) print ans if __name__ == '__main__':
    resolve() __name__ == '__main__' __name__ '__main__' resolve() resolve def SS(): return input() def SS(): return input() SS def F(): return float(input()) def F(): return float(input()) F def LF(): return [float(x) for x in input().split()] def LF(): return [float(x) for x in input().split()] LF def LI_(): return [int(x)-1 for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] LI_ INF = 10**20 10**20 INF def I(): return int(input()) def I(): return int(input()) I def LI(): return [int(x) for x in input().split()] def LI(): return [int(x) for x in input().split()] LI def resolve():
    S = SS()

    ans = 0
    stk = []
    for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

    print(ans) def resolve():
    S = SS()

    ans = 0
    stk = []
    for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

    print(ans) resolve input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input def LS(): return input().split() def LS(): return input().split() LS
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    S = SS()

    ans = 0
    stk = []
    for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

    print(ans)

if __name__ == '__main__':
    resolve()
