Code Submission Evaluation System Login

CSES - HIIT Open 2018

HIIT Open 2018

Contest start:2018-05-26 11:00:00
Contest end:2018-05-26 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2018-05-26 11:37:23
2018-05-26 11:27:05
Task:Inversions
Sender:El Numero Uno
Submission time:2018-05-26 11:27:05
Status:READY
Result:ACCEPTED

Show test data

Code

s = input()

b1, b2 = "0", "1"
i1, i2 = 0, 0
for c in s:
	if (c == b1):
		i1 += 1
	if (c == b2):
		i2 += 1
	b1 = "1" if b1 == "0" else "0"
	b2 = "1" if b2 == "0" else "0"
if (i1 < i2):
	print(i1)
else:
	print(i2)