Problem:
 Score : 300 points    Problem Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N .  The i -th tile from the left is painted black if the i -th character of S is 0 , and painted white if that character is 1 .  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?      Constraints  1 \leq |S| \leq 10^5  S_i is 0 or 1 .         Input Input is given from Standard Input in the following format:  S       Output Print the minimum number of tiles that need to be repainted to satisfy the condition.        Sample Input 1 000      Sample Output 1 1  The condition can be satisfied by repainting the middle tile white.       Sample Input 2 10010010      Sample Output 2 3       Sample Input 3 0      Sample Output 3 0

Solution (Python):
from collections import deque
S = input()
cnt = 0
dq = deque()
for i in range(len(S)):
    if not dq:
        dq.append(S[i])
    elif dq[-1] == "0" and S[i] == "0":
        cnt += 1
        dq.append("1")
    elif dq[-1] == "1" and S[i] == "1":
        cnt += 1
        dq.append("0")
    else:
        dq.append(S[i])
print(cnt)

Solution (Python):
s = input()
def check(s):
    ans = 0
    for i in range(len(s)):
        if i % 2 == 0 and s[i] != '0':
            ans += 1
        if i % 2 == 1 and s[i] != '1':
            ans += 1
    ans2 = 0
    for i in range(len(s)):
        if i % 2 == 0 and s[i] != '1':
            ans2 += 1
        if i % 2 == 1 and s[i] != '0':
            ans2 += 1
    return min(ans,ans2)
print(check(s))

Solution (Python):

def inpl(): return list(map(int, input().split()))
S = input()
ans1 = 0
ans2 = 0
for i, s in enumerate(S):
    if i%2:
        ans1 += s == "0"
        ans2 += s != "0"
    else:
        ans1 += s != "0"
        ans2 += s == "0"
print(min(ans1, ans2))

Solution (Python):
S = input()

result1 = 0
result2 = 0

for i, c in enumerate(S):
    if i % 2 == 0:
        if c == '0':
            result1 += 1
        else:
            result2 += 1
    else:
        if c == '0':
            result2 += 1
        else:
            result1 += 1


result = min(result1, result2)
print(result)

Solution (Python):
s = input()

bw = 0
wb = 0
for i,c in enumerate(s):
	if i%2 == 0:
		if c == '0':
			wb += 1
		else:
			bw += 1
	else:
		if c == '0':
			bw += 1
		else:
			wb += 1

print(min(bw,wb))

Solution (Python):
S = input()
T = '01'*len(S)
ans = 10**8
ctr = 0
for s , t in zip(S, T):
    if t != s:
        ctr += 1
ans = min(ans, ctr)
T = '10'*len(S)
ctr = 0
for s , t in zip(S, T):
    if t != s:
        ctr += 1
ans = min(ans, ctr)
print(ans)

Solution (Python):
S = list(input())

sum = 0
for i in range(len(S)):
	if i % 2 == 0:
		if S[i] == "0":
			sum += 1
	else:
		if S[i] == "1":
			sum += 1
			
print(min(sum,len(S) - sum))

Solution (Python):
S = list(input())
count = 0
for i in range(len(S) - 1):
    if S[i+1] == S[i]:
        count += 1
        if S[i+1] == '1':
            S[i+1] = '0'
        else:
            S[i+1] = '1'
            
print(count)

Solution (Python):
S = (input())
e = S[::2].count("0")
o = S[1::2].count("1")
print(min(e+o,len(S)-(e+o)))

Solution (Python):
s = list(input())
ans = 0

for i in range(1,len(s)):
    if s[i] == "0" and s[i-1] == "0":
        s[i] = "1"
        ans += 1
    if s[i] == "1" and s[i-1] == "1":
        s[i] = "0"
        ans += 1

print(ans)

Solution (Python):
S = raw_input()

T = '01' * (len(S) / 2) + ('0' if len(S) % 2 == 1 else '')
U = '10' * (len(S) / 2) + ('1' if len(S) % 2 == 1 else '')

t, u = 0, 0
for i in xrange(len(S)):
    if S[i] != T[i]:
        t += 1
    if S[i] != U[i]:
        u += 1

print min(t, u)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

S = list(map(int,list(str(input()))))
N = len(S)
ans = 0
for i in range(N):
    if i%2 == 0 and S[i] == 0:
        ans += 1
    elif i%2 == 1 and S[i] == 1:
        ans += 1

print(min(ans,N-ans))

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

S = raw_input()
cnt1 = cnt2 = 0
for i in range(len(S)):
    if ((S[i] == '0') + (i % 2 == 0)) % 2:
        cnt1 += 1
    else:
        cnt2 += 1
print min(cnt1, cnt2)

Solution (Python):
def main():
    S = input()
    costA = 0
    costB = 0
    for i in range(len(S)):
        if int(S[i]) != (i % 2):
            costA += 1
        else:
            costB += 1
    print(min(costA, costB))


if __name__ == "__main__":
    main()

Solution (Python):
A = list(map(int, list(input())))
N = len(A)
ans = 1<<29

for x in range(2):
    tmp = 0
    B = [0 for _ in range(N)]
    for i in range(x, N, 2):
        B[i] = 1
    for i in range(N):
        if A[i] != B[i]:
            tmp += 1
    ans = min(ans, tmp)

print (ans)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = ns()

cand1 = 0
for i, si in enumerate(s):
    if i % 2:
        if si == '0':
            cand1 += 1
            
    else:
        if si == '1':
            cand1 += 1
       
        
cand2 = 0
for i, si in enumerate(s):
    if i % 2:
        if si == '1':
            cand2 += 1
            
    else:
        if si == '0':
            cand2 += 1

print(min(cand1, cand2))

Solution (Python):
s = input()
f0 = 0
for i in range(len(s)):
    if i % 2 == 0:
        f0 += (0 if s[i] == '0' else 1)
    else:
        f0 += (1 if s[i] == '0' else 0)

print(f0 if f0<=len(s)//2 else len(s)-f0)

Solution (Python):
s = input()
n = len(s)
x = sum(1 if int(s[i]) != i%2 else 0 for i in range(n))
y = sum(0 if int(s[i]) != i%2 else 1 for i in range(n))
print(min(x, y))

Solution (Python):
s=input()
print(min(sum([s[0::2].count('1'),s[1::2].count('0')]),sum([s[0::2].count('0'),s[1::2].count('1')])))

Solution (Python):
S = input()

k = 0
s = 0
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "0":
      k += 1
    else:
      s += 1
  else:
    if S[i] == "1":
      k += 1
    else:
      s += 1

print(min(k, s))

Solution (Python):
S=input()
a=0
b=0
for i in range(len(S)):
    if int(S[i])==i%2:
        a+=1
    else:
        b+=1
print(min(a,b))

Solution (Python):
s = input()
a = [1 if i % 2 == 0 else 0 for i in range(len(s))]
b = [0 if i % 2 == 0 else 1 for i in range(len(s))]


da = 0
db = 0
for i in range(len(s)):
    if str(a[i]) != s[i]:
        da += 1
    if str(b[i]) != s[i]:
        db += 1

print(min(da, db))

Solution (Python):
s = input()
n = len(s)
ans1 = 0
for i in range(n):
    if i%2 == 0:
        if s[i] != "0":
            ans1 += 1
    else:
        if s[i] != "1":
            ans1 += 1
ans2 = 0
for i in range(n):
    if i%2 == 0:
        if s[i] == "0":
            ans2 += 1
    else:
        if s[i] == "1":
            ans2 += 1

print(min(ans1,ans2))

Solution (Python):
def d201(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='0'):
                count+=1
        else:
            if(a[i]=='1'):
                count+=1
    return count

                
def d210(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='1'):
                count+=1
        else:
            if(a[i]=='0'):
                count+=1
    return count

a=input()
print(min(d210(a),d201(a)))

Solution (Python):
s = input()
a = s[::2].count("0") + s[1::2].count("1")
b = s[::2].count("1") + s[1::2].count("0")
print(min(a,b))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [tuple(map(int, l.split())) for l in sys.stdin]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    s = [int(c) for c in S()]
    l = len(s)
    t = u = 0
    for i in range(l):
        if s[i] == i % 2:
            t += 1
        else:
            u += 1

    return min(t,u)


print(main())

Solution (Python):
S=input()
N=len(S)

ANS1=0
ANS2=0

for i in range(N):
    if i%2==0:
        if S[i]=="0":
            ANS1+=1

        else:
            ANS2+=1

    else:
        if S[i]=="0":
            ANS2+=1
        else:
            ANS1+=1

    

print(min(ANS1,ANS2))

Solution (Python):
S = input()
ans = 0
if S[0] == '0':
    for i, x in enumerate(S):
        if i%2 == 0 and x == '1':
            ans +=1
        elif i%2 == 1 and x =='0':
            ans += 1
elif S[0] == '1':
    for i, x in enumerate(S):
        if i%2 == 0 and x == '0':
            ans +=1
        elif i%2 == 1 and x =='1':
            ans += 1
print(ans)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    a,b = LI()
    if a == b:
        print(2*a)
    else:
        print(2*max(a,b)-1)
    return


def B():
    n = I()
    h = LI()
    m = h[0]
    ans = 1
    for i in range(1,n):
        if m <= h[i]:
            ans += 1
            m = h[i]
    print(ans)
    return


def C():
    s = S()
    ans = 0
    n = len(s)
    t = ["1" if i%2 else "0" for i in range(n)]
    for i in range(n):
        if t[i] != s[i]:
            ans += 1
    ans2 = 0
    t = ["0" if i%2 else "1" for i in range(n)]
    for i in range(n):
        if t[i] != s[i]:
            ans2 += 1
    print(min(ans,ans2))
    return


def D():
    n = I()

    return


if __name__ == "__main__":
    C()

Solution (Python):
*S, = map(int, input())
ans = len(S)
for k in range(2):
    r = 0
    for i in range(len(S)):
        if (i%2)^k != S[i]:
            r += 1
    ans = min(ans, r)
print(ans)

Solution (Python):
s=list(map(int,input()))
lis=[]
for i in range(len(s)):
    if i%2==0:
        lis.append(0)
    else:
        lis.append(1)
cnt=0
for i in range(len(s)):
    if s[i]!=lis[i]:
        cnt+=1
print(min(cnt,len(s)-cnt))

Solution (Python):
S = list(map(int, input().strip()))
best = N = len(S)
for c in range(2):
    n_flip = 0
    for i in range(N):
        n_flip += S[i] ^ c
        c ^= 1
    best = min(best, n_flip)
print(best)

Solution (Python):
def solve(init, s):
    t = init
    ret = 0
    for c in s:
        if c != t:
            ret += 1
        t ^= 1
    return ret


s = input()
s = list(map(int, s))
print(min(solve(0, s), solve(1, s)))

Solution (Python):
S=list(input())
cnt1,cnt2=0,0

for i,s in enumerate(S):
    if i%2==0:
        if s=='1':
            cnt1+=1
    else:
        if s=='0':
            cnt1+=1

for i,s in enumerate(S):
    if i%2==1:
        if s=='1':
            cnt2+=1
    else:
        if s=='0':
            cnt2+=1
print(min(cnt1,cnt2))

Solution (Python):
s = input()
res1, res2 = 0, 0
for i, j in enumerate(s):
    if i % 2 == 0:
        if j == '0':
            res1 += 1
    else:
        if j == '1':
            res1 += 1
for i, j in enumerate(s):
    if i % 2 == 1:
        if j == '0':
            res2 += 1
    else:
        if j == '1':
            res2 += 1
print(min(res1, res2))