s = eval(input())

len_s = len(s)

cnt = [0, 0]

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

    memo_0 = s[i - 1]

    memo_1 = s[len_s - i]

    if s[i] != memo_0:

        cnt[0] += 1

    if s[len_s - i - 1] != memo_1:

        cnt[1] += 1

print((min(cnt)))

s = eval(input())

len_s = len(s)

cnt = 0

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

    memo_0 = s[i - 1]

    if s[i] != memo_0:

        cnt += 1

print(cnt)

s = eval(input())
len_s = len(s)
cnt = [0, 0]
for i in range(1, len(s)):
    memo_0 = s[i - 1]
    memo_1 = s[len_s - i]
    if s[i] != memo_0:
        cnt[0] += 1
    if s[len_s - i - 1] != memo_1:
        cnt[1] += 1
print((min(cnt)))

s = eval(input())
len_s = len(s)
cnt = 0
for i in range(1, len(s)):
    memo_0 = s[i - 1]
    if s[i] != memo_0:
        cnt += 1
print(cnt)

-cnt = [0, 0] +cnt = 0 -    memo_1 = s[len_s - i] -        cnt[0] += 1 -    if s[len_s - i - 1] != memo_1: -        cnt[1] += 1 -print((min(cnt))) +        cnt += 1 +print(cnt)