#!/usr/bin/env python3
s = input()
n = len(s)
c = 0
p = ""
count = 0
for i in s:
    if i == p:
        count += 1
    else:
        c = count - c
        count = 1
    p = i
c = count - c
print(n - abs(c)) s = input() s input() input n = len(s) n len(s) len s c = 0 c 0 p = "" p "" count = 0 count 0 for i in s:
    if i == p:
        count += 1
    else:
        c = count - c
        count = 1
    p = i i s if i == p:
        count += 1
    else:
        c = count - c
        count = 1
     i == p i p count += 1 count 1 c = count - c c count - c count c count = 1 count 1 p = i p i c = count - c c count - c count c print(n - abs(c)) print n - abs(c) n abs(c) abs c count = 0 0 count c = count - c count - c c c = count - c count - c c n = len(s) len(s) n p = i i p s = input() input() s count += 1 1 count count = 1 1 count p = "" "" p c = 0 0 c
#!/usr/bin/env python3
s = input()
n = len(s)
c = 0
p = ""
count = 0
for i in s:
    if i == p:
        count += 1
    else:
        c = count - c
        count = 1
    p = i
c = count - c
print(n - abs(c))
