S = list(eval(input()))

i = 0

count = 0

while(i < len(S)-1):

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

    count+=1

  i+=1

  

print(count)

  

  



S = list(eval(input()))

i = 0

count = 0

for i in range(len(S)-1):

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

    count+=1

  

print(count)

  

  



S = list(eval(input()))
i = 0
count = 0
while i < len(S) - 1:
    if S[i] != S[i + 1]:
        count += 1
    i += 1
print(count)

S = list(eval(input()))
i = 0
count = 0
for i in range(len(S) - 1):
    if S[i] != S[i + 1]:
        count += 1
print(count)

-while i < len(S) - 1: +for i in range(len(S) - 1): -    i += 1