s = eval(input())

a = ""

cnt, cnt_ = 0, 0

while len(a) <= len(s):

    a += "10"



for i in range(len(s)):

    if s[i] != a[i]:

        cnt += 1

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

        cnt_ += 1

print((min(cnt, cnt_)))
s = eval(input())

cnt, cnt_ = 0, 0

a = "10" * (len(s)//2+1)

for i in range(len(s)):

    if s[i] != a[i]:

        cnt += 1

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

        cnt_ += 1

print((min(cnt, cnt_)))
s = eval(input())
a = ""
cnt, cnt_ = 0, 0
while len(a) <= len(s):
    a += "10"
for i in range(len(s)):
    if s[i] != a[i]:
        cnt += 1
    if s[i] != a[i + 1]:
        cnt_ += 1
print((min(cnt, cnt_)))

s = eval(input())
cnt, cnt_ = 0, 0
a = "10" * (len(s) // 2 + 1)
for i in range(len(s)):
    if s[i] != a[i]:
        cnt += 1
    if s[i] != a[i + 1]:
        cnt_ += 1
print((min(cnt, cnt_)))

-a = "" -while len(a) <= len(s): -    a += "10" +a = "10" * (len(s) // 2 + 1)