S = input().strip()

N = len(S)

cur = 0

cnt = 0

for i in range(1,N):

    if S[i]!=S[cur]:

        cnt += 1

        cur = i

print(cnt)
S = input().strip()

cnt = 0

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

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

        cnt += 1

print(cnt)
S = input().strip()
N = len(S)
cur = 0
cnt = 0
for i in range(1, N):
    if S[i] != S[cur]:
        cnt += 1
        cur = i
print(cnt)

S = input().strip()
cnt = 0
for i in range(1, len(S)):
    if S[i] != S[i - 1]:
        cnt += 1
print(cnt)

-N = len(S) -cur = 0 -for i in range(1, N): -    if S[i] != S[cur]: +for i in range(1, len(S)): +    if S[i] != S[i - 1]: -        cur = i