r = 0

p = None

f = False

for c in eval(input()):

    if f:

        f = False

        r += 1

    elif c == p:

        f, p = True, None

    else:

        r += 1

        p = c

print(r)

r = 0

f, p = False, None

for c in eval(input()):

    if f:

        f, p = False, None

        r += 1

    elif c == p:

        f = True

    else:

        r += 1

        p = c

print(r)

r = 0
p = None
f = False
for c in eval(input()):
    if f:
        f = False
        r += 1
    elif c == p:
        f, p = True, None
    else:
        r += 1
        p = c
print(r)

r = 0
f, p = False, None
for c in eval(input()):
    if f:
        f, p = False, None
        r += 1
    elif c == p:
        f = True
    else:
        r += 1
        p = c
print(r)

-p = None -f = False +f, p = False, None -        f = False +        f, p = False, None -        f, p = True, None +        f = True