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):
s = list(input())
slen = len(s)

count_0 = 0
count_1 = 0



for i in s[0::2]:
	if i != '0':
		count_0 += 1
for i in s[1::2]:
	if i != '1':
		count_0 += 1

for i in s[0::2]:
	if i != '1':
		count_1 += 1
for i in s[1::2]:
	if i != '0':
		count_1 += 1

if count_1 > count_0:
	print(count_0)
else:
	print(count_1)

Solution (Python):
s = input()
n = len(s)

odd = 0
even = 0

for i in range(n):
    if i % 2 == 0:
        if s[i] == "1":
            odd += 1
        else:
            even += 1
    else:
        if s[i] == "0":
            odd += 1
        else:
            even += 1

ans = min(odd, even)

print(ans)

Solution (Python):
s = input()
n = len(s)

ans0, ans1 = 0, 0
n0_even, n0_odd = 0, 0
for i in range(n):
    if s[i] == "0":
        if i%2 == 0:
            n0_even += 1
        else:
            n0_odd += 1
n1_even = (n+1)//2 - n0_even
n1_odd = n//2 - n0_odd
ans0 = n1_even+n0_odd
ans1 = n0_even+n1_odd
print(min(ans0, ans1))

Solution (Python):
S = input()


count_0 = 0
count_1 = 0

current_0 = 0
current_1 = 1 
for s in S:
    if int(s) != current_0:
        count_0 += 1

    if int(s) != current_1:
        count_1 += 1

    current_0 += 1
    current_0 %= 2 

    current_1 += 1
    current_1 %= 2 

print(min(count_0, count_1))

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

Solution (Python):
S = input()

x = S[::2].count("0") + (S[1::2]).count("1")
print(min(x, len(S)-x))

Solution (Python):
S=input()

ls = len(S)
cnt1 = 0
for i in range(ls):
    if (i % 2 == 0):
        if(S[i] == '0'):
            cnt1 += 1
    if (i % 2 == 1):
        if(S[i] == '1'):
            cnt1 += 1
cnt2 = 0
for i in range(ls):
    if (i % 2 == 0):
        if(S[i] == '1'):
            cnt2 += 1
    if (i % 2 == 1):
        if(S[i] == '0'):
            cnt2 += 1

print(min(cnt1,cnt2))

Solution (Python):


import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main(S):
    n1 = 0
    n2 = 0
    for i in range(len(S)):
        if i % 2 == 0:
            if S[i] == '0':
                n1 += 1
            else:
                n2 += 1
        if i % 2 == 1:
            if S[i] == '1':
                n1 += 1
            else:
                n2 += 1
    n = min(n1, n2)
    print(n)

S = i2s()
main(S)

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

Solution (Python):
if __name__ == "__main__":
    s = input()
    case1 = 0
    isZero = True
    for ss in s:
        if (isZero and ss == "1") or (not isZero and ss == "0"):
            case1 += 1
        isZero = not isZero
    isZero = False
    case2 = 0
    for ss in s:
        if (isZero and ss == "1") or (not isZero and ss == "0"):
            case2 += 1
        isZero = not isZero
    print(min(case1, case2))

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

ans0 = 0
for i in range(len(S)):
    if i % 2 == 0:
        if int(S[i]) == 0:
            ans0 += 1
        else:
            pass
    else:
        if int(S[i]) == 1:
            ans0 += 1
        else:
            pass

ans1 = 0
for i in range(len(S)):
    if i % 2 == 1:
        if int(S[i]) == 0:
            ans1 += 1
        else:
            pass
    else:
        if int(S[i]) == 1:
            ans1 += 1
        else:
            pass

print(min(ans0, ans1))

Solution (Python):
List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for (i,j) in zip(List,a):
	if int(i) != int(j):
		c1 += 1

for (i,j) in zip(List,b):
	if int(i) != int(j):
		c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

Solution (Python):
s = input()
l1 = s[::2]
l2 = s[1::2]
c1 = l1.count('0') + l2.count('1')
c2 = l1.count('1') + l2.count('0')
print(min(c1,c2))

Solution (Python):
s = input()
ans = s[0]
count = 0
for i in range(1, len(s)):
    if ans[len(ans)-1] == s[i]:
        if s[i] == "0":
            ans += "1"
        else:
            ans += "0"
        count += 1
    else:
        ans += s[i]
print(count)

Solution (Python):
s=input()
N=len(s)
A=0
B=0
for i in range(0,N,2):
    if s[i]=='0':
        A+=1
    if i+1==N:
        break
    if s[i+1]=='1':
        B+=1
if A+B<=N/2:
    print(A+B)
else:
    print(N-(A+B))

Solution (Python):
s = input()
cnt0 = 0
cnt1 = 0
tile = ['0','1']
ans0 = ''
ans1 = ''
for i in range(len(s)):
    ans0 += tile[i%2]
    ans1 += tile[(i+1)%2]

for i,j,k in zip(s,ans0,ans1):
    if i != j:
        cnt0 += 1
    if i != k:
        cnt1 += 1
print(min(cnt0,cnt1))

Solution (Python):
S = input()
x = '0'
num = 0

for i in range(len(S)):
  if S[i] != x:
    num = num + 1
  if x == '0':
    x = '1'
  else:
    x = '0'

print(min(num, len(S)-num))

Solution (Python):
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator



inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    
    s = get_str()
    b = int("0" + s, 2)
    zo = "01" * ((len(s) // 2) + 1)
    x = int("0" + zo[0:len(s)], 2)
    y = int("0" + zo[1:len(s)+1], 2)
    print(min(bin(b ^ x).count("1"), bin(b ^ y).count("1")))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()

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

Solution (Python):
x = input()
n = len(x)

arr1_dif = 0
arr2_dif = 0
for i in range(n):
  if i%2 == 0:
    if x[i] == '0':
      arr1_dif += 1
    else:
      arr2_dif += 1
  else:
    if x[i] == '0':
      arr2_dif += 1
    else:
      arr1_dif += 1

print(arr1_dif if arr1_dif<arr2_dif else arr2_dif)

Solution (Python):
s = input()
ans = [0,0]

for i in range(len(s)):
  if (int(s[i])+i)%2==0:
    ans[0] += 1
  else:
    ans[1] += 1
print(min(ans))

Solution (Python):


a = list(map(int, input()))


def rev01(x):
  if x == 0:
    return 1
  else:
    return 0

cnt = 0
for i, v in enumerate(a):
  if i == 0:
    prev = v
  else:
    if v != rev01(prev):

      cnt += 1
      prev = rev01(v)
    else:
      prev = v
      
print(cnt)

Solution (Python):
val = input()
zero = '0'
one = '1'
c = 0
l = list(val)
for i in range(len(l)):
  if i == 0:
    continue
  if l[i - 1] == l[i]:
    if l[i - 1] == zero:
      l[i] = one
    else:
      l[i] = zero
    c = c + 1
print(c)

Solution (Python):
S = input()
s = list(map(int, S))
t = s.copy()
n = len(s)
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in range(n-1):
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1
    
for i in range(n-1):
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))

Solution (Python):

S = input()
N = len(S)
A = 0
B = 0
for i in range(0,N,2):
    if S[i] == "0":
        A += 1
    if i+1==N:
        break
    if S[i+1] == "1":
        B += 1
if A + B <= N//2:
    print(A + B)
else:
    print(N-(A+B))

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

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

Solution (Python):
T=list(map(int,input()))

cnt=0
prev=0
for i, t in enumerate(T):
  if prev == t:
    cnt+=1
    prev= 1 if t==0 else 0
  else:
    prev=t

    
print(min(cnt,len(T)-cnt))

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

cnt = 0

for i in range(int(len(s))):
    if i == int(len(s)):
        break
    elif i == 0:
        continue
    else:
        if s[i] == s[i-1]:
            cnt += 1
            if s[i] == '0':
                s[i] = '1'
            else:
                s[i] = '0'

print(cnt)

Solution (Python):
s = input()


ptn1 = s[::2].count("1") + s[1::2].count("0")

ptn2 = s[::2].count("0") + s[1::2].count("1")

print(min(ptn1, ptn2))

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


a1 = 0
a2 = 1
re1 = 0
re2 = 0
for s in S:
    if int(s) != a1:
        re1 += 1
    if int(s) != a2:
        re2 +=1
        
    a1 = (a1+1) % 2
    a2 = (a2+1) % 2
    
if re1 < re2:
    print(re1)
else:
    print(re2)

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

if n % 2 == 0:
    mihon0 = '01' * (n//2)
    mihon1 = '10' * (n//2)
else:
    mihon0 = '0' + '10' * (n//2)
    mihon1 = '1' + '01' * (n//2)

ans0, ans1 = 0, 0
for i in range(n):
    if S[i] != mihon0[i]:
        ans0 += 1
    if S[i] != mihon1[i]:
        ans1 += 1

print(min(ans0, ans1))

Solution (Python):
s = input()

first_c = s[0]
ans = 0
for c in s:
    if first_c != c:
        ans += 1
    if first_c == '0':
        first_c = '1'
    else:
        first_c = '0'
print(ans)

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

Solution (Python):
S = list(map(int, input()))
ans1 = 0
ans2 = 0
for i in range (len(S)):
  if i % 2 == 0 and S[i] == 0:
      ans1 += 1
  elif i %2 ==1 and S[i] == 1:
      ans1 += 1
for i in range(len(S)):
  if i % 2 == 0 and S[i] == 1:
      ans2 += 1
  elif i % 2 ==1 and S[i] == 0:
      ans2 += 1
print(min(ans1, ans2))

Solution (Python):
tile=list(map(int,input()))
n=len(tile)
sum=0
for i in range(n):
  sum+=(i-tile[i])%2
print(min(sum,n-sum))

Solution (Python):
s = input()
a = s[::2].count('0') + s[1::2].count('1')
print(min(a, len(s)-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):
S = input()
len_S = len(S)
cnt1 = 0

if len_S%2 == 0:
  ans = "01"*(len_S//2)
else:
  ans = "01"*(len_S//2)+"0"
for i in range(len_S):
  if S[i]!=ans[i]:
    cnt1 += 1
final_ans = min(len_S-cnt1,cnt1)
print(final_ans)

Solution (Python):
import collections
S = list(input())
c_odd = collections.Counter(S[::2])
c_evn = collections.Counter(S[1::2])
if c_odd['0'] > c_evn['0']:
    a = c_odd['1'] + c_evn['0']
else:
    a = c_odd['0'] + c_evn['1']

if c_odd['1'] > c_evn['1']:
    b = c_odd['0'] + c_evn['1']
else:
    b = c_odd['1'] + c_evn['0']
print(min(a, b))

Solution (Python):
n=input()
x=[n[i] for i in range(0,len(n),2)]
y=[n[i] for i in range(1,len(n),2)]
a=x.count('0')+y.count('1')
print(min(a,len(n)-a))

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

def counting(swt):
    cnt = 0
    for i in S:
        if swt == 0 and i == "1":
            i = "0"
            cnt += 1
            swt = 1
        elif swt == 1 and i == "0":
            i = "1"
            cnt += 1
            swt = 0
        else:
            if swt == 0:
                swt = 1
            else:
                swt = 0
    return cnt

print(min(counting(0),counting(1)))

Solution (Python):
s = str(raw_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):
s = input()
t = len(s)
a = '01'*int(t/2) + '0'*int(t%2)
b = '10'*int(t/2) + '1'*int(t%2)
cta = 0
ctb = 0
for i in range(t):
    if s[i] == a[i]:
        cta += 1
    elif s[i] == b[i]:
        ctb += 1
if cta <= ctb:
    print(cta)
else:
    print(ctb)

Solution (Python):


s = input()
s_list1 = list(s)
s_list2 = list(s)
count1 = 0



s_len = len(s_list1)
pre = int(s_list1.pop(0))
for i in range(s_len-1):
    if pre == int(s_list1.pop(0)):
        pre = 1 - pre
        count1 += 1
    else:
        pre = 1 - pre
if count1 <= s_len//2:
    print(count1)
else:
    print(s_len-count1)

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):
S=list(map(int,input()))
N=len(S)
print(min([sum([(i%2-S[i]+m)%2 for i in range(N)]) for m in range(2)]))

Solution (Python):
inpl = input()
c1 = 0
c2 = 0

for i,s in enumerate(inpl):
    if i % 2 != 0:
        if s == '0':
            c1 += 1
    else:
        if s == '1':
            c1 += 1

for i,s in enumerate(inpl):
    if i % 2 != 1:
        if s == '0':
            c2 += 1
    else:
        if s == '1':
            c2 += 1
print(c1 if c1 < c2 else c2)

Solution (Python):
inpl = input()
c1 = 0
c2 = 0

for i in range(1,len(inpl)+1):
    if i % 2 != 0:
        if inpl[i-1] == '0':
            c1 += 1
    else:
        if inpl[i-1] == '1':
            c1 += 1

for i in range(1,len(inpl)+1):
    if i % 2 != 1:
        if inpl[i-1] == '0':
            c2 += 1
    else:
        if inpl[i-1] == '1':
            c2 += 1
print(c1 if c1 < c2 else c2)

Solution (Python):
S = str(input())
temp, temp2 = "", ""
ans1, ans2 = 0, 0
for i in range(len(S)):
    if i % 2 == 0:
        temp += "0"
        temp2 += "1"
    else:
        temp += "1"
        temp2 += "0"
    if temp[i] == S[i]:
        ans1 += 1
    elif temp2[i] == S[i]:
        ans2 += 1
        
print(min(ans1, ans2))

Solution (Python):
s = input()
n = len(s)
white_start = 0
black_start = 0
for i in range(n):
    if s[i] == '0' and i%2 == 0:
        black_start += 1
    elif s[i] == '0' and i%2 == 1:
        white_start += 1
    elif s[i] == '1' and i%2 == 0:
        white_start += 1
    else:
        black_start += 1
print(min(black_start,white_start))

Solution (Python):
l = list(input())
l = list(map(int,l))



x = [0] * len(l)

for i in range(0,len(l)):
    if i % 2 == 0:
        x[i] = 0
    else:
        x[i] = 1



count = 0

for i in range(0,len(l)):
    if l[i] != x[i]:
        count += 1
    
print(min(count,len(l)-count))

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

Solution (Python):
def main(n):
	odd = "1"
	even= "0"
	if(n[0] =="0"):
		
		odd = "0"
		even= "1"
	a = sum((((i % 2 != 0) and n[i] == odd)) for i in range(1, len(n),2))
	b = sum((((i % 2 == 0) and n[i] == even)) for i in range(0, len(n),2))
	return a+b

print(main(input()))

Solution (Python):
def main(n):
	odd = "1"
	even= "0"
	if(n[0] =="0"):
		
		odd = "0"
		even= "1"
	
	a = sum((((i % 2 != 0) and n[i] == odd)) for i in range(1, len(n),2))
	b = sum((((i % 2 == 0) and n[i] == even)) for i in range(0, len(n),2))
	return a+b

print(main(input()))

Solution (Python):
def main(n):
	odd = "1"
	even= "0"
	if(n[0] =="0"):
		
		odd = "0"
		even= "1"
	return sum((((i % 2 == 0) and (n[i] == even)) or ((i % 2 != 0) and n[i] == odd)) for i in range(1, len(n)))

print(main(input()))

Solution (Python):
s = [int(x) for x in list(input())]
a = [x%2 for x in range(len(s))]
b = [(1 - x%2) for x in range(len(s))]
c1=0
c2=0
for i in range(len(s)):
    if a[i] != s[i]:
        c1 += 1
    if b[i] != s[i]:
        c2 += 1

print(min([c1,c2]))

Solution (Python):
def main(n):
	r = 0
	if(n[0] =="0"):
		
		return sum((((i % 2 == 0) and (n[i] == "1")) or ((i % 2 != 0) and n[i] == "0")) for i in range(1, len(n)))
	else:
		
		return sum((((i % 2 == 0) and (n[i] == "0")) or ((i % 2 != 0) and n[i] == "1")) for i in range(1, len(n)))

print(main(input()))

Solution (Python):
s = list(input())
sl = list(map(int,s))

l1 = []
for i in range(len(sl)):
  l1.append(i%2)

d1 = 0
for i in range(len(sl)):
  if sl[i] != l1[i]:
    d1 += 1

print(min(d1,len(sl)-d1))

Solution (Python):
def main(n):
	r = 0
	f = n[0]
	if(f =="0"):
		
		for i in range(1, len(n)):
			if(i % 2 == 0): 
				
				if(n[i]=="1"):
					r+=1
			else: 
				
				if(n[i]=="0"):
					r+=1
	else:
		
		for i in range(1, len(n)):
			if(i % 2 == 0): 
				
				if(n[i]=="0"):
					r+=1
			else: 
				
				if(n[i]=="1"):
					r+=1
	
	return r

print(main(input()))

Solution (Python):
s = list(input())
sl = list(map(int,s))

l1 = []
l2 = []
for i in range(len(sl)):
  l1.append(i%2)
  l2.append((i+1)%2)

d1 = 0
d2 = 0
for i in range(len(sl)):
  if sl[i] != l1[i]:
    d1 += 1
  if sl[i] != l2[i]:
    d2 += 1

print(min(d1,d2))

Solution (Python):
cnt_st0 = 0
cnt_st1 = 0
in_str = str(input())
for i, m in enumerate(in_str):
  if i % 2 == 0:
    if str(m) == '0':
      cnt_st1 += 1
    else:
      cnt_st0 += 1
  else:
    if str(m) == '0':
      cnt_st0 += 1
    else:
      cnt_st1 += 1
print(min(cnt_st0, cnt_st1))

Solution (Python):
S = input()
N = len(S)
BstartS_count = 0
WstartS_count = 0

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

output = BstartS_count
if WstartS_count < output:
    output = WstartS_count

print(output)

Solution (Python):
strS = list(str(input()))
S = [int(n) for n in strS]
N =len(S)
cnt = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        cnt += 1
        if S[i] == 0:
            S[i+1] = 1
        else:
            S[i+1] = 0

print(cnt)

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

cost_start_with_zero = 0
cost_start_with_one = 0

for i in range(len(inp)):
    if i%2==0 and inp[i]!="0":
        cost_start_with_zero += 1
    if i%2==1 and inp[i]!="1":
        cost_start_with_zero += 1
    if i%2==0 and inp[i]!="1":
        cost_start_with_one += 1
    if i%2==1 and inp[i]!="0":
        cost_start_with_one += 1

print(min(cost_start_with_one,cost_start_with_zero))

Solution (Python):


s=input()

ans1=0
for i in range(len(s)):
    if i%2:
        if s[i]!='1':
            ans1+=1
    else:
        if s[i]!='0':
            ans1+=1

ans2=0
for i in range(len(s)):
    if i%2:
        if s[i]!='0':
            ans2+=1
    else:
        if s[i]!='1':
            ans2+=1

print(min(ans1,ans2))

Solution (Python):


N = input()
count = 0

for i in range(len(N)):
    if(int(N[i]) != (i % 2)):
        count = count + 1

if(count > (len(N) / 2)):
    count = len(N) - count

print(count)

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

for s in S[:1]:
    flag = int(s)
count = 0

for s in S[1:]:
    if s == "0":
        if flag == 0:
            count += 1
            flag = 1
        else:
            flag = 0
    else:
        if flag == 1:
            count += 1
            flag = 0
        else:
            flag = 1
print(count)

Solution (Python):
s = input()



odd_s = s[::2]
even_s = s[1::2]

odd_b = odd_s.count('0')
odd_w = odd_s.count('1')
even_b = even_s.count('0')
even_w = even_s.count('1')

change_num = min(odd_w + even_b, odd_b + even_w)


print(change_num)

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):
cash = input()
S = list(cash)
cash0 = ""
cash1 = ""
for i in range(len(S)):
	if i % 2 == 0:
		cash0 = cash0 + "0"
		cash1 = cash1 + "1"
	else:
		cash0 = cash0 + "1"
		cash1 = cash1 + "0"
cash0 = list(cash0)
cash1 = list(cash1)
num0=0
num1=0
for i in range(len(S)):
	if S[i]==cash0[i]:
		num0=num0+1
	if S[i]==cash1[i]:
		num1=num1+1
print(min(num0,num1))

Solution (Python):
s=input()

length=len(s)

s1=''
s2=''
count1=0
count2=0

for i in range(int(length/2)):
    s1+='10'
if int(length%2)==1:
    s1+='1'

for i in range(int(length/2)):
    s2+='01'
if int(length%2)==1:
    s2+='0'




for i in range(length):
    if s[i]!=s1[i]:
        count1+=1
        
for i in range(length):
    if s[i]!=s2[i]:
        count2+=1


print(min(count1,count2))

Solution (Python):
s = input()
L = [str(i % 2) for i in range(len(s))]
start0 = "".join(L)
start1 = "".join(L[1:])
if len(s) % 2 == 0:
    start1 += "0"
else:
    start1 += "1"
count_start0 = 0
count_start1 = 0

for i in range(len(s)):
    if s[i] != start0[i]:
        count_start0 += 1

for i in range(len(s)):
    if s[i] != start1[i]:
        count_start1 += 1
print(min(count_start0,count_start1))

Solution (Python):
a = input()
b = len(a)
k = 0
str = []
str = list(a)
for i in range(1,b):
    if str[i-1] == "0" and str[i] == "0":
        str[i] = "1"

        k = k + 1
    
    if str[i-1] == "1" and str[i] == "1":
        str[i] = "0"
        k = k + 1

print(k)

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

Solution (Python):
tiles = input()
left = tiles[0]
count = -1
num = 0
for color in tiles:
    if left == color:
        count += 1
        if num == 0:
            left = color
        else:
            left = '0' if color == '1' else '1'
    else:
        left = color
    num += 1
print(count)

Solution (Python):
tiles = list(map(int, input()))

even = tiles[0::2]
odd = tiles[1::2]

even0 = even.count(0)
even1 = even.count(1)
odd0 = odd.count(0)
odd1 = odd.count(1)

if even0 >= max(even1, odd0, odd1) or odd1 >= max(even0, even1, odd0):
    print (even1 + odd0)

elif even1 >= max(even0, odd0, odd1) or odd0 >= max(even0, even1, odd1):
    print (even0 + odd1)

Solution (Python):
tiles = list(map(int, input()))

even = tiles[0::2]
odd = tiles[1::2]

if even.count(0) >= even.count(1):
    ans1 = even.count(1) + odd.count(0) 

else:
    ans1 = even.count(0) + odd.count(1)
    
if odd.count(0) >= odd.count(1):
    ans2 = odd.count(1) + even.count(0) 

else:
    ans2 = odd.count(0) + even.count(1)

print (min(ans1, ans2))

Solution (Python):

*s, = map(int,input())


ans = len(s)


for i in range(2):
    
    cnt = 0

    for j in range(len(s)):
        if (j % 2 == 0) ^ (s[j] == i):
            cnt = cnt +1
    ans = min(ans, cnt)

print(ans)

Solution (Python):
S = input()

cost0 = 0
cost1 = 0

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

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

print(min(cost0,cost1))

Solution (Python):

ss = input()
*s, = map(int,ss)

if len(s)%2 == 0:
    s0 = [0,1] *(len(s)//2)
    s1 = [1,0] *(len(s)//2)
else:
    s0 = [0,1] *(len(s)//2)
    s0.append(0)
    s1 = [1,0] *(len(s)//2)
    s1.append(1)

sum0 = 0
sum1 = 0
for i in range(len(s)):   
    if s0[i] != s[i]:
        sum0 = sum0 +1
    if s1[i] != s[i]:
        sum1 = sum1 +1

ans = min(sum0, sum1)
print(ans)

Solution (Python):
s = list(input())
ans1 = 0
ans2 = 0
t = True
for char in s:
    t = not t
    if((char == "0") ^ t):
        ans1 += 1
    else:
        ans2 += 1
print(min(ans1,ans2))

Solution (Python):
from sys import stdin

s = [int(x) for x in stdin.readline().rstrip()]
n = len(s)


res = 0
for i,name in enumerate(s):
    if i%2 == 0 and name == 0:
        res += 1
    elif i%2 == 1 and name == 1:
        res += 1


res2 = 0
for i,name in enumerate(s):
    if i%2 == 0 and name == 1:
        res2 += 1
    elif i%2 == 1 and name == 0:
        res2 += 1
print(min(res,res2))

Solution (Python):
tile_list = list(map(str, input()))

odd_diff_count = 0
even_diff_count = 0

for i in range(len(tile_list)):
    
    if i % 2 == 0:
        if tile_list[i] != "0":
            odd_diff_count += 1
        else:
            even_diff_count += 1
    else:
        if tile_list[i] != "1":
            odd_diff_count += 1
        else:
            even_diff_count += 1

if odd_diff_count >= even_diff_count:
    print(even_diff_count)
else:
    print(odd_diff_count)

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

Solution (Python):
s = input()
ansA, ansB = 0, 0
for i in range(len(s)):
    if(i % 2 == 0):
        if(s[i]=="1"):
            ansA += 1
        else:
            ansB += 1
    else:
        if(s[i]=="0"):
            ansA += 1
        else:
            ansB += 1
print(ansA if ansA < ansB else ansB)

Solution (Python):
ss = input()
ans = 1
fir_kuro = 0
fir_siro = 0
counter = 0
for s in ss:
    if counter%2 == 0:
        fir_kuro += 0 if s == '1' else 1
        fir_siro += 0 if s == '0' else 1
    else:
        fir_kuro += 0 if s == '0' else 1
        fir_siro += 0 if s == '1' else 1
    counter += 1
print(min(fir_kuro, fir_siro))

Solution (Python):
s = input()
l = len(s)

prev = 0
ans1 = 0
for i in s:
    if prev != int(i):
        ans1 += 1
    if prev == 1:
        prev = 0
    else:
        prev = 1


prev = 1
ans2 = 0
for i in s:
    if prev != int(i):
        ans2 += 1
    if prev == 1:
        prev = 0
    else:
        prev = 1

print(min(ans1, ans2))

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

Solution (Python):
S = str(input())
l = len(S)
OZ = '10' * int(l/2)
ZO = '01' * int(l/2)
if(l%2!=0):
    OZ += '1'
    ZO += '0'
cntOZ=0
cntZO=0
for i in range(l):
    if(S[i]==OZ[i]):
        cntOZ+=1
    else:
        cntZO+=1


if(cntOZ <= cntZO):
    print(cntOZ)
else:
    print(cntZO)

Solution (Python):



tile_list = input()

ansfz = 0
ansfo = 0

for i,s in enumerate(tile_list):
    
    if int(s) == (i % 2):
        ansfz += 1
    else :
        ansfo += 1

print(min(ansfz,ansfo))

Solution (Python):
S = input()
c1 = c2 = 0
for i, s in enumerate(S):
    if i % 2 == 0:
        if s == '1':
            c1 += 1
        else:
            c2 += 1
    else:
        if s == '0':
            c1 += 1
        else:
            c2 += 1
print(min(c1, c2))

Solution (Python):

import sys
input = sys.stdin.readline
s = list(input())

cost_0, cost_1 = 0, 0

for i in s[::2]:
	if i == "1":
		cost_0 += 1
for i in s[1::2]:
	if i == "0":
		cost_0 += 1

for i in s[::2]:
	if i == "0":
		cost_1 += 1
for i in s[1::2]:
	if i == "1":
		cost_1 += 1
		 
print(min(cost_0, cost_1))

Solution (Python):
import re
import sys
from itertools import product

import numpy as np

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    S = ii(str)
    a = 0
    b = 0
    for i, s in enumerate(S):
        if i % 2 == 0:
            if s == "0":
                a += 1
            else:
                b += 1
        else:
            if s == "0":
                b += 1
            else:
                a += 1
    return min(a, b)


if __name__ == "__main__":
    print(solve())

Solution (Python):


s = list(input())

cost_0, cost_1 = 0, 0

for i in s[::2]:
	if i == "1":
		cost_0 += 1
for i in s[1::2]:
	if i == "0":
		cost_0 += 1

for i in s[::2]:
	if i == "0":
		cost_1 += 1
for i in s[1::2]:
	if i == "1":
		cost_1 += 1
		 
print(min(cost_0, cost_1))

Solution (Python):
a=list(input())
s=0
for i in range(len(a)):
    if i%2==int(a[i]):
        s=s+1
m=min(s,len(a)-s)  
print(m)

Solution (Python):
s = list(map(int, input()))
o = s[::2]
e = s[1::2]
l_o = len(o)
l_e = len(e)
o_o = sum(o)
o_e = sum(e)

print(min(l_o - o_o + o_e, o_o + l_e - o_e))

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

count = 0
for i in range(len(s)):
    if i == 0:
        continue
    if int(s[i]) == int(s[i-1]):
        count += 1
        if int(s[i]) == 0:
            s[i] = '1'
        else:
            s[i] = '0'

print(count)

Solution (Python):
numbers = input()

count = 0
for i, num in enumerate(numbers):
    if int(num) != i % 2:
        count += 1

if count <= len(numbers)/2:
    print(count)
else:
    print(len(numbers)-count)

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

S1 =[];
for i in range(len(S)):
    if i%2 ==0:
        S1.append("1");
    else:
        S1.append("0");

change1 =0;
change2 =0;

for i in range(len(S)):
    if S[i] !=S1[i]:
        change1 +=1;
    else:
        change2 +=1;
        
print(min(change1,change2));

Solution (Python):
s = input()
n = len(s)
cnt = 0

for i, si in enumerate(s):
  ti = '0' if i%2 == 0 else '1'
  if si != ti:
    cnt += 1

print(min(cnt, n - cnt))

Solution (Python):
def smaller(x, y):
	if x < y: return x
	else: return y

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

Solution (Python):
S = input()
res1 = S[::2].count('0')+S[1::2].count('1')
res2 = S[1::2].count('0')+S[::2].count('1')
print(min(res1,res2))

Solution (Python):
S = input()
ans1 = 0 
ans2 = 0 
for i, s in enumerate(S):
    if s == '0' and i % 2 == 0:
        ans1 += 1
    elif s == '0' and i % 2 == 1:
        ans2 += 1
    elif s == '1' and i % 2 == 0:
        ans2 += 1
    else:
        ans1 += 1
print(min(ans1, ans2))

Solution (Python):
S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if wb[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_wb, cnt_bw))

Solution (Python):
S =  input()
countA =0
countB =0
for i in range(len(S)):
    if i % 2 == 0:
        if int(S[i]) == 1:
            countA += 1
        else:
            countB += 1
    else:
        if int(S[i]) == 1:
            countB += 1
        else:
            countA += 1            
if countA > countB:
    print(countB)
else:
    print(countA)