l = list(eval(input()))

n = len(l)



idx = 0

seg = []

while idx < n:

    while idx < n-1 and l[idx] == l[idx+1]:

        idx+=1

    seg.append(idx)

    idx+=1

print((len(seg)-1))

l = list(eval(input()))

n = len(l)



seg = []

for i in range(n-1):

    if l[i] != l[i+1]:

        seg.append(i)

print((len(seg)))

l = list(eval(input()))
n = len(l)
idx = 0
seg = []
while idx < n:
    while idx < n - 1 and l[idx] == l[idx + 1]:
        idx += 1
    seg.append(idx)
    idx += 1
print((len(seg) - 1))

l = list(eval(input()))
n = len(l)
seg = []
for i in range(n - 1):
    if l[i] != l[i + 1]:
        seg.append(i)
print((len(seg)))

-idx = 0 -while idx < n: -    while idx < n - 1 and l[idx] == l[idx + 1]: -        idx += 1 -    seg.append(idx) -    idx += 1 -print((len(seg) - 1)) +for i in range(n - 1): +    if l[i] != l[i + 1]: +        seg.append(i) +print((len(seg)))