s=list(eval(input()))

if(len(s)==1):

    print((0))

else:

    a=s[:]

    fir,sec=0,0

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

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

            s[i+1] = str(1 - (ord(s[i])-48))

            fir+=1

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

        if(a[i]==a[i-1]):

            a[i-1] = str(1 - (ord(a[i])-48))

            sec+=1

    print((min(fir,sec)))

    

    

s=list(eval(input()))

if(len(s)==1):

    print((0))

else:

    a=s[:]

    fir,sec=0,0

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

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

            s[i+1] = str(1 - (ord(s[i])-48))

            fir+=1

    print(fir)

    

    

s = list(eval(input()))
if len(s) == 1:
    print((0))
else:
    a = s[:]
    fir, sec = 0, 0
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            s[i + 1] = str(1 - (ord(s[i]) - 48))
            fir += 1
    for i in range(len(s) - 1, 0, -1):
        if a[i] == a[i - 1]:
            a[i - 1] = str(1 - (ord(a[i]) - 48))
            sec += 1
    print((min(fir, sec)))

s = list(eval(input()))
if len(s) == 1:
    print((0))
else:
    a = s[:]
    fir, sec = 0, 0
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            s[i + 1] = str(1 - (ord(s[i]) - 48))
            fir += 1
    print(fir)

-    for i in range(len(s) - 1, 0, -1): -        if a[i] == a[i - 1]: -            a[i - 1] = str(1 - (ord(a[i]) - 48)) -            sec += 1 -    print((min(fir, sec))) +    print(fir)