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:19:46
Task:Inversions
Sender:TreamDeam
Submission time:2018-05-26 11:19:46
Status:READY
Result:ACCEPTED

Show test data

Code

n = input().rstrip()
a, b = 0, 0
for i, el in enumerate(n):
 if i % 2 == 0:
  if el == '0':
   b += 1
  else:
   a += 1
 else:
  if el == '0':
   a += 1
  else:
   b += 1

print(min(a,b))