s = list(eval(input()))

count1 = 0

s_copy = s.copy()

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

    if s[i] == s[i+1]:

        count1 += 1

        if s[i+1] == '0':

            s[i+1] = '1'

        else:

            s[i+1] = '0'

s = s_copy.copy()

s.reverse()

count2 = 0

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

    if s[i] == s[i+1]:

        count2 += 1

        if s[i+1] == '0':

            s[i+1] = '1'

        else:

            s[i+1] = '0'

print((min(count1,count2)))
s = list(eval(input()))

count1 = 0

s_copy = s.copy()

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

    if s[i] == s[i+1]:

        count1 += 1

        if s[i+1] == '0':

            s[i+1] = '1'

        else:

            s[i+1] = '0'

print(count1)
s = list(eval(input()))
count1 = 0
s_copy = s.copy()
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        count1 += 1
        if s[i + 1] == "0":
            s[i + 1] = "1"
        else:
            s[i + 1] = "0"
s = s_copy.copy()
s.reverse()
count2 = 0
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        count2 += 1
        if s[i + 1] == "0":
            s[i + 1] = "1"
        else:
            s[i + 1] = "0"
print((min(count1, count2)))

s = list(eval(input()))
count1 = 0
s_copy = s.copy()
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        count1 += 1
        if s[i + 1] == "0":
            s[i + 1] = "1"
        else:
            s[i + 1] = "0"
print(count1)

-s = s_copy.copy() -s.reverse() -count2 = 0 -for i in range(len(s) - 1): -    if s[i] == s[i + 1]: -        count2 += 1 -        if s[i + 1] == "0": -            s[i + 1] = "1" -        else: -            s[i + 1] = "0" -print((min(count1, count2))) +print(count1)