s = input()

count = 0

oi1000 = "0"*1000 + "1"*1000
io1000 = "1"*1000 + "0"*1000

while oi1000 in s or io1000 in s:
    while oi1000 in s:
        s = s.replace(oi1000, "", 1)
        count += 1000
    while io1000 in s:
        s = s.replace(io1000, "", 1)
        count += 1000

oi100 = "0"*100 + "1"*100
io100 = "1"*100 + "0"*100

while oi100 in s or io100 in s:
    while oi100 in s:
        s = s.replace(oi100, "", 1)
        count += 100
    while io100 in s:
        s = s.replace(io100, "", 1)
        count += 100

oi10 = "0"*10 + "1"*10
io10 = "1"*10 + "0"*10

while oi10 in s or io10 in s:
    while oi10 in s:
        s = s.replace(oi10, "", 1)
        count += 10
    while io10 in s:
        s = s.replace(io10, "", 1)
        count += 10

while "01" in s or "10" in s:
    while "01" in s:
        num = s.count("01")
        s = s.replace("01", "")
        count += num
    while "10" in s:
        num = s.count("10")
        s = s.replace("10", "")
        count += num

print(count * 2)
