from sys import stdin

# 標準入力の受取
sdi = stdin.readline().rstrip()
# a, b, c = stdin.readline().rstrip().split()
# a, b, c = [x for x in stdin.readline().rstrip().split()]
# a, b, c = [int(x) for x in stdin.readline().rstrip().split()]
l = list(sdi)
l.reverse()
start = len(l)
i = 0
while len(l) - 1 >= i + 1:
    print(l)
    if l[i] != l[i + 1]:
        l.pop(i + 1)
        l.pop(i)
        i = max(i - 2, 0)
        continue
    i += 1
print(start - len(l))
