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-----
000

-----Sample Output-----
1

The condition can be satisfied by repainting the middle tile white.

Difficulty: introductory

Starter code:

Solutions:
s = list(input())

ans = 0
for i in range(1, len(s)):
  if s[i] == s[i-1]:
    ans += 1
    if s[i] == '1':
      s[i] = '0'
    else:
      s[i] = '1'
    
print(ans)

import copy

S=list(input())
S_=copy.deepcopy(S)
N=len(S)
ans=N
cnt=0

for i in range(N-1):
	if S[i]==S[i+1]:
		cnt+=1
		if S[i+1]=="0":
			S[i+1]="1"
		else:
			S[i+1]="0"

print((min(cnt,ans)))


s = list(input())

count = 0
for i in range(len(s)-1):
  if s[i] == s[i+1] and s[i] == "0":
    s[i+1] = "1"
    count += 1
  elif s[i] == s[i+1] and s[i] == "1":
    s[i+1] = "0"
    count += 1
  else:
    pass
  
print(count)

s = str(input())
con = 0
con2 = 0
ans = 0
ans2 = 0
for i in range(len(s)):
  if i % 2 == 0:
    ans += 1
    if s[i] == '0':
      con += 1
  else:
    ans2 += 1
    if s[i] == '1':
      con2 += 1
L = [con + con2, (ans - con) + (ans2 - con2)]
print((min(L)))


S = input()
N = len(S)

cnt_1 = 0
cnt_2 = 0

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

for j in range(N):
  if j%2 == 0:
    if S[j] == "1":
      cnt_2 += 1
  else:
    if S[j] == "0":
      cnt_2 += 1
      
print(min(cnt_1,cnt_2))

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    ans1 = ans2 = 0
    for i, c in enumerate(S):
        if i % 2 == int(c):
            ans1 += 1
        else:
            ans2 += 1

    print((min(ans1, ans2)))
    return


def __starting_point():
    main()

__starting_point()

S = str(input())

N = len(S)
cnt = 0
for i in range(N):
  if S[0] == '0':
    if i%2==0 and S[i]!='0':
      cnt += 1
    elif i%2==1 and S[i]=='0':
      cnt += 1
  else:
    if i%2==0 and S[i]!='1':
      cnt += 1
    elif i%2==1 and S[i]=='1':
      cnt += 1
print(cnt)

# -*- coding: utf-8 -*-
"""
Created on Fri Sep 11 01:37:10 2020

@author: liang
"""

S = input()
N = len(S)
ans = 0
for i in range(N):
    if i%2 == 0 and S[i] == "0":
        ans += 1
    if i%2 == 1 and S[i] == "1":
        ans += 1
ans = min(ans, N - ans)
print(ans)

S = input()

c = 0
l = len(S)

for i in range(l):
    if S[i] == str(i % 2):
        c += 1

print(min(c, l-c))

s=input()

tmp1 = ''
tmp2 = ''
for i in range(len(s)):
  if i % 2 == 0:
    tmp1 += '0'
    tmp2 += '1'
  else:
    tmp1 += '1'
    tmp2 += '0'

diff_tmp1 = 0
diff_tmp2 = 0
for i in range(len(s)):
  if tmp1[i] != s[i]:
    diff_tmp1 += 1
  elif tmp2[i] != s[i]:
    diff_tmp2 += 1
print(min(diff_tmp1,diff_tmp2))

S = input()
ans = 0

if S[0]=="0":
  ans += S[0::2].count("1")
  ans += S[1::2].count("0")
  
else:
  ans += S[0::2].count("0")
  ans += S[1::2].count("1")
  
print(ans)

S=input()
temp=0

for i in range(len(S)):
    if S[i]!="0" and i%2==0:
        temp+=1
    if S[i]!="1" and i%2==1:
        temp+=1
ans=temp

temp=0
for i in range(len(S)):
    if S[i]!="0" and i%2==1:
        temp+=1
    if S[i]!="1" and i%2==0:
        temp+=1
if temp<ans:
    ans=temp

print(ans)


s = list(map(int, input()))
cnt = 0

for i in range(0, len(s) - 1):
    if s[i] == s[i + 1]:
        s[i + 1] = abs(s[i + 1] * 1 - 1)
        cnt += 1
print(cnt)

s=input()
s=list(s)
c=0
for i in range(0,len(s),2):
    if s[i]=='0':
        c+=1
for i in range(1,len(s),2):
    if s[i]=='1':
        c+=1
d=0
for i in range(0,len(s),2):
    if s[i]=='1':
        d+=1
for i in range(1,len(s),2):
    if s[i]=='0':
        d+=1
    
print(min(c,d))

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


S = input()
L = [int(i) for i in S]
b = 1
B = 0
for i in L:
  if i != b:
    B += 1
  b = 1 - b
l = len(L)
print(min(B, l - B))

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

s=input()
s1 = []
s2 = []
ans1 = 0
ans2 = 0
for i in range(len(s)):
    if i%2 != 0:
        s1.append('0')
    else:
        s1.append('1')
for i in range(len(s)):
    if i%2 == 0:
        s2.append('0')
    else:
        s2.append('1')

for x, y in zip(s, s1):
    if x != y:
        ans1 +=1
for x, y in zip(s, s2):
    if x != y:
        ans2 +=1

print(min(ans1,ans2))

s = input()

result = 10 ** 9
# 0始まりで揃える場合
tmp = 0
for i, c in enumerate(s):
  if i & 1:
    if c == '0':
      tmp += 1
  else:
    if c == '1':
      tmp += 1
      
result = min(result, tmp)
tmp = 0

# 1始まりで揃える場合
for i, c in enumerate(s):
  if i & 1:
    if c == '1':
      tmp += 1
  else:
    if c == '0':
      tmp += 1
      
result = min(result, tmp)
print(result)

s = input()
x = ""
y = ""
x_con = 0
y_con = 0
for i in range(len(s)):
  if i % 2 == 0:
    x += "0"
    y += "1"
  else:
    x += "1"
    y += "0"

for i in range(len(s)):
  if s[i] != x[i]:
    x_con += 1
  if s[i] != y[i]:
    y_con += 1
  
print(min(x_con, y_con))

s = input()
n = len(s)
c = 0
for i in range(n):
  if int(s[i])%2==i%2:
    c+=1
print(min(c, n-c))

S = list(input())
n = len(S)
lens = n // 2
plus = False
if n % 2 != 0:
  plus = True
test1 = "01" * lens
test2 = "10" * lens
if plus:
  test1 += "0"
  test2 += "1"
test1, test2 = list(test1), list(test2)
count1, count2 = 0, 0
for i in range(n):
  if S[i] != test1[i]:
    count1 += 1
  if S[i] != test2[i]:
    count2 += 1
print(min(count1, count2))

S = input()
count = 0

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

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


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    S = input().rstrip()
    l = len(S)
    a1 = 0
    a0 = 0
    
    for i in range(l):
        if i % 2 == 0:
            if S[i] == "1":
                a1+=1
            else:
                a0+=1
        else:
            if S[i] == "0":
                a1+=1
            else:
                a0+=1
                
    print(min(a0, a1))
    
def __starting_point():
    main()
__starting_point()

s = input()
n = len(s)

res1 = 0
res2 = 0

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

print(min(res1,res2))

import copy
S=input()
ListS = list(S)
revListS = copy.deepcopy(ListS)
norm = 0
rev = 0
N = len(ListS)
for i in range(1,N):
  if ListS[i] == ListS[i-1]:
    ListS[i] = str(abs(int(ListS[i])-1))
    norm += 1
  if revListS[N-i-1] == revListS[N-i]:
    revListS[N-i-1] = str(abs(int(revListS[N-i-1])-1))
    rev += 1
res = min(norm,rev)
print(res)

s=input()

start_0=0
start_1=0

for i,j in enumerate(s):
  if i%2==0 and j=="1":
    start_0+=1
  elif i%2!=0 and j=="0":
    start_0+=1
  elif i%2==0 and j=="0":
    start_1+=1
  elif i%2!=0 and j=="1":
    start_1+=1
    
print((min(start_0, start_1)))


import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    S = input().rstrip()
    n = len(S)

    res1 = res2 = 0
    for i in range(n):
        if i % 2 == 0:
            if S[i] == "0":
                res1 += 1
            else:
                res2 += 1
        else:
            if S[i] == "1":
                res1 += 1
            else:
                res2 += 1
    print((min(res1, res2)))


def __starting_point():
    resolve()

__starting_point()

S = list(map(int, list(input())))
first_letter = S[0]
second_letter = 0 if first_letter else 1
res = 0
res += len([i for i in S[0::2] if i!=first_letter])
res += len([i for i in S[1::2] if i!=second_letter])
print(res)

S = list(input())

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

#黑から
cnt2 = 0
for i, s in enumerate(S):
    if i % 2 == 0:
        if s != '1':
            cnt2 += 1
    else:
        if s != '0':
            cnt2 += 1

print((min(cnt1,cnt2)))



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:
            ans2 += 1
    else:
        if s[i] == 0:
            ans2 += 1
        else:
            ans1 += 1
ans = min(ans1, ans2)
print(ans)

S = input()

A = [1 if i % 2 == 0 else 0 for i in range(len(S))]
B = [1 if i % 2 != 0 else 0 for i in range(len(S))]

A_cost = 0
B_cost = 0

i = 0

for i in range(len(S)):
    if int(S[i]) != A[i]:
        A_cost += 1
    if int(S[i]) != B[i]:
        B_cost += 1

print(min(A_cost,B_cost))

str10,str01 = '',''
for i in range(5 * (10**4) + 1):
    str10 += '10'
    str01 += '01'

s = str(input())
len_s = len(s)
str10 = str10[:len_s]
str01 = str01[:len_s]
#print(str10,str01)

cnt10,cnt01 = 0,0
for i in range(len_s):
    if s[i]!=str10[i]:
        cnt10 += 1
    if s[i]!=str01[i]:
        cnt01 += 1
print(min(cnt10,cnt01))

S = [int(x) for x in list(input())]
bw = [0, 1]
wb = [1, 0]
ans1 = 0
ans2 = 0
for i in range(len(S)):
  if(S[i]!=bw[i%2]):
    ans1 += 1
  if(S[i]!=wb[i%2]):
    ans2 += 1
print(min(ans1,ans2))

s = input()

start = ['0', '1']
ans = 10**6
for offset in [0,1]:
    now = 0
    for i in range(len(s)):
        j = (i+offset) % 2
        if s[i] != start[j]:
            now += 1
    ans = min(ans, now)

print(ans)


S = input()

N = len(S)
O,E = 0,0
for i,s in enumerate(S):
  O +=(i%2)^int(s)
  E +=(i%2)^(not int(s))
print(min(O,E))

s=input()
l=len(s)
a,b="", ""
for i in range(l):
  if i %2==0:
    a += "1"
    b += "0"
  else:
    a += "0"
    b += "1"
diff_a, diff_b = 0, 0
for i in range(l):
  if a[i] != s[i]:
    diff_a += 1
  if b[i] != s[i]:
    diff_b += 1
print(min(diff_a, diff_b))

S = list(input())

cnt = 0

for i in range(len(S)-1):
    if S[i] == S[i+1] == '0':
        S[i+1] = '1'
        cnt += 1
    elif S[i] == S[i+1] == '1':
        S[i+1] = '0'
        cnt += 1
    else:
        pass

print(cnt)


import copy
S_0 = list(input())
S = [int(n) for n in S_0]
S_1 = copy.copy(S)
S_1[0] = 1- S_1[0]
l = len(S)
i = 0
cnt_0 = 0
cnt_1 = 1
for i in range(l-1):
  if S[i+1] == S[i]:
    cnt_0 += 1
    S[i+1] = 1 - S[i]
for i in range(l-1):
  if S_1[i+1] == S_1[i]:
    cnt_1 += 1
    S_1[i+1] = 1 - S_1[i]
print(min([cnt_0, cnt_1]))

s = input()

odd_0=0
odd_1=0
even_0=0
even_1=0
for i in range(len(s)):
    if(i%2==0):
        if(s[i]=='0'):
            odd_0+=1
        else:
            odd_1+=1
    else:
        if(s[i]=='0'):
            even_0+=1
        else:
            even_1+=1

a=odd_0+even_1
b=odd_1+even_0
ans = min(a,b)

print(ans)


S = input()
checker = '01'*100001
keep1 = checker[:len(S)]
keep2 = checker[1:len(S)+1]
ans_1 = 0
ans_2 = 0
for i in range(len(S)):
    if S[i] != keep1[i]:
        ans_1 += 1
    else:
        ans_2 += 1
print(min(ans_1, ans_2))

s=input()
n=len(s)
l=[0 for _ in range(n)]
for i in range(n):
    if s[i]=='1':
        l[i]=1

brack=[0 if i%2==1 else 1 for i in range(n)]
white=[1 if i%2==1 else 0 for i in range(n)]

cnt_1,cnt_2=0,0
for i in range(n):
    cnt_1+=l[i]^brack[i]
    cnt_2+=l[i]^white[i]
print((min(cnt_1,cnt_2)))




S = list(input())
f = S[0]
c = 0
for i in range(1, len(S)):
  if i % 2 == 1:
    if f == S[i]:
      c += 1
  else:
    if f != S[i]:
      c += 1
print(c)

S = input()
b = 1
B = 0
for i in S:
  if int(i) != b:
    B += 1
  b = 1 - b
l = len(S)
print(min(B, l - B))

S = input()
b = 1
B = 0
l = 0
for i in S:
  if int(i) != b:
    B += 1
  b = 1 - b
  l += 1
print(min(B, l - B))

s=input()
mae=""
cnt=0
for i in range(len(s)):
  if mae==s[i]:
    cnt+=1
    if s[i]=="0":
      mae="1"
    else:
      mae="0"

  else:
    mae=s[i]
    
print(cnt)



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

S = input()
N = len(S)
 
# 最終的な結果は '0101...' or '1010...' の2通り
# 2通りとのハミング距離の最小値を求める
 
a1, a2 = 0, 0
# '0101...' との距離
for i in range(N):
  if i % 2 == 0 and S[i] == '1': a1 += 1 # 奇数番目
  if i % 2 == 1 and S[i] == '0': a1 += 1 # 偶数番目
# '1010...' との距離
for i in range(N):
  if i % 2 == 0 and S[i] == '0': a2 += 1 # 奇数番目
  if i % 2 == 1 and S[i] == '1': a2 += 1 # 偶数番目
print(min(a1, a2))

s=list(input())
r1=0
r2=0
for ii,ss in enumerate(s):
  if ii%2==0:
    if ss=="0":
      r1+=1
    else:
      r2+=1
  else:
    if ss=="1":
      r1+=1
    else:
      r2+=1
#print(r1,r2)
print(min(r1,r2))

S = input()

count1 = S[::2].count('0') + S[1::2].count('1')
count2 = len(S) - count1

print(min(count1, count2))

s = input()
n = len(s)
s0 = "01" * (n//2)
s1 = "10" * (n//2)
if n % 2 == 1:
  s0 += "0"
  s1 += "1"

a0 = 0
a1 = 0
for i in range(n):
  if s[i] != s0[i]:
    a0 += 1
  if s[i] != s1[i]:
    a1 += 1
print(min(a0, a1))

s = input()
a = s[::2].count("0") + s[1::2].count("1")
print(min(a, len(s)-a))

S = input()

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

w = list(input())
ans = 0
for i in range(len(w)-1):
    if w[i] == w[i+1]:
        if w[i] == "0":
            w[i+1] = "1"
        else:
            w[i+1] = "0"
        ans += 1
print(ans)


s=input()
S=len(s)

li_0=[]
for i in s:
    li_0.append(int(i))

li=[0,1]*10**5
li_1=[]
li_2=[]

cnt1=0
cnt2=0

for i in range(S):
    li_1.append(li[i])
    li_2.append(li[i+1])

for i in range(S):
    if li_0[i]==li_1[i]:
        cnt1+=1
    if li_0[i]==li_2[i]:
        cnt2+=1

if cnt1>=cnt2:
    print((S-cnt1))
else:
    print((S-cnt2))


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

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-10-08 14:36:20 +0900
# LastModified: 2020-10-08 14:41:46 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    S = input()
    ans_1 = 0
    ans_2 = 0
    for i, s in enumerate(S):
        if i%2 == 0 and s == '1':
            ans_1 += 1
        elif i%2 == 1 and s == '0':
            ans_1 += 1
        if i%2 == 0 and s == '0':
            ans_2 += 1
        elif i%2 == 1 and s == '1':
            ans_2 += 1
    print((min(ans_1, ans_2)))


def __starting_point():
    main()

__starting_point()

import sys
import copy
import math
import itertools
import numpy as np
S = input()
#010101...との比較
cnt = [0,0]
for i in range(len(S)):
    if i%2==0 and int(S[i]) == 1:
        cnt[0]+=1
    elif i%2 == 1 and int(S[i]) == 0:
        cnt[0]+=1
    
    if i%2==0 and int(S[i]) == 0:
        cnt[1]+=1
    elif i%2 == 1 and int(S[i]) == 1:
        cnt[1]+=1
    
if cnt[0]<=cnt[1]:
    print(cnt[0])
else:
    print(cnt[1])

def resolve():
    '''
    code here
    '''
    S = input()

    ans1 = 0
    res1 = 0
    ans2 = 1
    res2 = 0
    for item in S:
        item = int(item)
        if ans1%2 != item:
            res1 += 1
        if ans2%2 != item:
            res2 += 1

        ans1 += 1
        ans2 += 1

    print((min(res2, res1))) 


def __starting_point():
    resolve()

__starting_point()

from collections import Counter
moji = str(input())
guall = len(moji)//2
kiall = guall + len(moji) % 2
gucount=dict(Counter(moji[1::2]))
kicount=dict(Counter(moji[0::2]))
if len(moji) == 1:
    ans = 0
elif max(gucount, key=gucount.get) != max(kicount, key=kicount.get):
    ans = guall - max(gucount.values()) + kiall - max(kicount.values())
else:
    if kiall - max(kicount.values()) > guall - max(gucount.values()):
        ans = max(kicount.values()) + guall - max(gucount.values())
    else:
        ans = max(gucount.values()) + kiall - max(kicount.values())
print(ans)

a = list(input())
b = list(reversed(a))
ans_f = 0
ans_r = 0
for i in range(len(a)-1):
  if a[i] == a[i+1]:
    a[i+1] = str(abs(int(a[i]) - 1))
    ans_f += 1
for i in range(len(a)-1):
  if b[i] == b[i+1]:
    b[i+1] = str(abs(int(b[i]) - 1))
    ans_r += 1
print(min(ans_f,ans_r))

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

S=input()
s=[]
total=0
for i in range(len(S)):
    s.append(int(S[i]))
for i in range(0,len(s)-1):
    if s[i]==s[i+1]:
        total+=1
        s[i+1]=abs(1-s[i])
print(total)

a=input()
b=int(len(a))
c=0
d=0
if b%2==0:
  for i in range(b//2):
    if a[2*i]=="1":
      c=c+1
    if a[2*i+1]=="0":
      c=c+1
  for i in range(b//2):
    if a[2*i]=="0":
      d=d+1
    if a[2*i+1]=="1":
      d=d+1
  if c>d:
    print(d)
  else:
    print(c)
if b%2==1:
  for i in range(b//2):
    if a[2*i]=="1":
      c=c+1
    if a[2*i+1]=="0":
      c=c+1
  if a[-1]=="1":
    c=c+1
  for i in range(b//2):
    if a[2*i]=="0":
      d=d+1
    if a[2*i+1]=="1":
      d=d+1
  if a[-1]=="0":
    d=d+1
  if c>d:
    print(d)
  else:
    print(c)

s = input()

if s[0] == "1":
    ans = 0
    for i in range(len(s)) :
        if i % 2 == 0 and s[i] != "1" :
            ans += 1
        elif i % 2 == 1 and s[i] != "0" :
            ans += 1
else :
    ans = 0
    for i in range(len(s)):
        if i % 2 == 0 and s[i] != "0":
            ans += 1
        elif i % 2 == 1 and s[i] != "1":
            ans += 1
print(ans)


S = input()
n = len(S)

ans1 = ('01' * 10**6)[:n]
ans2 = ('10' * 10**6)[:n]

count = 0

for i, j in zip(S, ans1):
    if i != j:
        count += 1
print(min(count, n-count))

S=input()
cnt=0
for i in range(len(S)):
    if i%2==int(S[i]):
        cnt+=1
print((min(cnt,len(S)-cnt)))


s = list(input())

count = 0

for i in range(1, len(s)):
    if s[i] == s[i-1]:
        count += 1

        if s[i] == '1':
            s[i] = '0'
        else:
            s[i] = '1'

print(count)

S = list(input())
f = S[0]
c = 0
for i in range(1, len(S)):
  if i % 2 == 1:
    if f == S[i]:
      c += 1
  else:
    if f != S[i]:
      c += 1
print(c)


s = input()
# 0: black
# 1: white
n = len(s)
li = [0]*n

for i in range(n):
    if s[i]=="1":
        li[i] = 1

b = [0]*n
w = [1]*n

for i in range(n):
    if i%2==1:
        b[i]=1
        w[i]=0

cnt_1 = 0
cnt_2 = 0
for i in range(n):
    cnt_1 += li[i]^b[i]
    cnt_2 += li[i]^w[i]
ans = min(cnt_1, cnt_2)
print(ans)

s = input()
n = len(s)

a = ""

for x in range(n):
  if x % 2 == 0:
    a = a + "1"
  else:
    a = a + "0"

count = 0
for y in range(n):
  if s[y] != a[y]:
    count += 1
    
print((min(count,n-count)))


    


S = input()
b = 1
B = 0
for i in S:
  if int(i) != int(b):
    B += 1
  b = not b
l = len(S)
print(min(B, l - B))

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

S = input()
N = len(S)

ans = 0
if S[0] == '0':
  for i in range(1, N):
    if i % 2 == 0 and S[i] == '1': ans += 1 # 奇数番目
    if i % 2 == 1 and S[i] == '0': ans += 1 # 偶数番目
else:
  for i in range(1, N):
    if i % 2 == 0 and S[i] == '0': ans += 1 # 奇数番目
    if i % 2 == 1 and S[i] == '1': ans += 1 # 偶数番目
print(ans)      


s = [int(x) for x in list(input())]
x = len(s)
y = [0 if i % 2 ==0 else 1 for i in range(x)]
z = [1 if i % 2 ==0 else 0 for i in range(x)]
count1 = 0
count2 = 0
ans1 = list(zip(s,y))
ans2 = list(zip(s,z))
for a in ans1:
  if a[0] != a[1]:
    count1 += 1
for a in ans2:
  if a[0] != a[1]:
    count2 += 1
print(min(count1,count2))

n = list(input())
cnt1 = 0
cnt2 = 0

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


S = input()
b = 1
B = 0
for i in S:
  if i != str(b):
    B += 1
  b = 1 - b
l = len(S)
print(min(B, l - B))

S = input()

idx1, idx2 = 0, 1
cnt1, cnt2 = 0, 0
for s in S:
    s = int(s)
    if s != idx1:
        cnt1 += 1
    if s != idx2:
        cnt2 += 1
    idx1, idx2 = abs(idx1-1), abs(idx2-1)

print(min(cnt1, cnt2))

S=list(input())
l=len(S)
s=0
for i in range(l-1):
    if S[i]==S[i+1] and S[i]=='0':
        s+=1
        S[i+1]='1'
    elif S[i]==S[i+1] and S[i]=='1':
        s+=1
        S[i+1]='0'
print(s)

s = input()

t, u = '', ''
for i in range(len(s)):
    t += '1' if i%2 == 0 else '0'
    u += '0' if i%2 == 0 else '1'

s = int(s, 2)
t = int(t, 2)
u = int(u, 2)
print(min(bin(s^t).count('1'), bin(s^u).count('1')))

S = input()
N = len(S)
s1, s2 = '', ''
for i in range(N):
    if i%2 == 0:
        s1 += '1'
        s2 += '0'
    else:
        s1 += '0'
        s2 += '1'

a1, a2 = 0, 0
for i in range(N):
    if s1[i] != S[i]:
        a1 += 1
    
    if s2[i] != S[i]:
        a2 += 1

ans = min(a1, a2)
print(ans)

s = input()

words = [w for w in s]

cnt = 0
for r in range(len(words) - 1):
    if words[r+1] == words[r]:
        if words[r+1] == '0':
            words[r+1] = '1'
        else:
            words[r+1] = '0'
        cnt += 1

print(cnt)

s= input()
a = [0]*len(s)
print(len(a)-s[1::2].count('0')-s[::2].count('1') if s[0]=='1' else len(a)-s[1::2].count('1')-s[::2].count('0'))

def change(W):
    if S[W]==0:
        S[W]=1
    else:
        S[W]=0
        
S=list(map(int,input()))
R=len(S)
B=R
Z=list(S)
for K in range(2):
    A=0
    if S[0]==K:
        A+=1
        change(0)
    for L in range(R-1):
        if S[L]==S[L+1]:
            A+=1
            change(L+1)
    if B>=A:
        B=A
    S=Z
print(B)

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    count = 0
    for i, c in enumerate(S):
        if i % 2 == int(c):
            count += 1

    print((min(count, len(S) - count)))
    return


def __starting_point():
    main()

__starting_point()

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    S = np.array(list(map(int,input().rstrip())))
    L = len(S)
    A = np.arange(L) & 1
    B = 1 - A
    x1 = (A!=S).sum()
    x2 = (B!=S).sum()
    print(min(x1,x2))

def __starting_point():
    main()
__starting_point()

s = input()
os = s[1::2]
es = s[::2]
l = os.count('0')+es.count('1')
print(min(l, len(s)-l))

s=input()
cnt=0

for i in range(len(s)):#白黒白黒...
  if i%2==0:
    if s[i]=="0":
      cnt+=1

  else:
    if s[i]=="1":
      cnt+=1

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

S = input()
A = S[0::2].count("1") + S[1::2].count("0")
B = S[0::2].count("0") + S[1::2].count("1")
  
print(min(A,B))

s = list(str(input()))
cnt = 0

if len(s)>1 and s[0]==s[1]:
    if s[0] == '1':
        s[1] = '0'
    else:
        s[1] = '1'
    cnt += 1

for i in range(1,len(s)-1):
    if s[i] == s[i+1]:
        s[i+1] = s[i-1]
        cnt += 1

print(cnt)


s = input()
s_length = len(s)

keep = '01' * 100000
keep_1 = keep[:s_length]
keep_2 = keep[1:s_length + 1]


ans_1 = 0
ans_2 = 0
for i in range(s_length):
    if s[i] != keep_1[i]:
        ans_1 += 1
    else:
        ans_2 += 1
print((min(ans_1, ans_2)))


N = list(map(int, list(input())))
p1 = 0
p2 = 0
flag = 0
for i in N:
  if i == flag:
    p1 += 1
  else:
    p2 += 1
  flag = 1 - flag
print(min(p1, p2))

s=input()
canw=0
canb=0
for i in range(len(s)):
  if i%2==1:
    if s[i]=='1':
      canw+=1
    else:
      canb+=1
  elif i%2==0:
    if s[i]=='1':
      canb+=1
    else:
      canw+=1

print(min(canb,canw))

s=input()
a="10"*10**5
b="01"*10**5
aa,bb=0,0
for i in range(len(s)):
    if s[i]==a[i]:
        bb+=1
    else:
        aa+=1
print(min(aa,bb))

s = input()
n = len(s)

x,y = 0,0  # x:0101... y:1010
for i in range(n):
  if i%2 == 0:
    if s[i] == '0':
      y+=1
    else:
      x+=1
  else:
    if s[i] == '0':
      x+=1
    else:
      y+=1
print(min(x,y))

s = input()
if len(s) == 1:
    ans = 0
else:
    ans_w = sum([ 1 for i in s[::2] if i != '1']) + sum([ 1 for i in s[1::2] if i != '0'])
    ans_b = sum([ 1 for i in s[::2] if i != '0']) + sum([ 1 for i in s[1::2] if i != '1'])
    ans = min([ans_w, ans_b])
print(ans) 

S = input()
left = S[0]
ans = 0
for i in range(1, len(S)):
    if left == "1" and S[i] == "1":
        left = "0"
        ans += 1
        continue
    elif left == "0" and S[i] == "0":
        left = "1"
        ans += 1
        continue
    else:
        left = S[i]

print(ans)


s=list(input())
ans=1e5
for i0 in range(2):
    sum=0
    for i in range(len(s)):
        x=i+i0
        if str(x%2)==s[i]:sum+=1
    ans=min(sum,ans)
print(ans)