s = eval(input())

s = list(map(int, s))

ans = len(s)

for i in range(2):

    cnt = 0

    for j, ss in enumerate(s):

        if (j + i) % 2 != ss: cnt += 1

    ans = min(ans, cnt)

print(ans)

inf = float('inf')



s = eval(input())



ans = inf

for start_color in '01':

    cost = 0

    for i, ss in enumerate(s):

        if i % 2 == 0:

            if ss != start_color:

                cost += 1

        else:

            if ss == start_color:

                cost += 1

    ans = min(ans, cost)

print(ans)

s = eval(input())
s = list(map(int, s))
ans = len(s)
for i in range(2):
    cnt = 0
    for j, ss in enumerate(s):
        if (j + i) % 2 != ss:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

inf = float("inf")
s = eval(input())
ans = inf
for start_color in "01":
    cost = 0
    for i, ss in enumerate(s):
        if i % 2 == 0:
            if ss != start_color:
                cost += 1
        else:
            if ss == start_color:
                cost += 1
    ans = min(ans, cost)
print(ans)

+inf = float("inf") -s = list(map(int, s)) -ans = len(s) -for i in range(2): -    cnt = 0 -    for j, ss in enumerate(s): -        if (j + i) % 2 != ss: -            cnt += 1 -    ans = min(ans, cnt) +ans = inf +for start_color in "01": +    cost = 0 +    for i, ss in enumerate(s): +        if i % 2 == 0: +            if ss != start_color: +                cost += 1 +        else: +            if ss == start_color: +                cost += 1 +    ans = min(ans, cost)