Preparing NOJ

GAME

1000ms 65536K

Description:

There is a string which consists 0s and 1s only.
Each time you can change one digit, with 0 changed to 1, or 1 changed to 0.
But when you change the digit, the digits on its left and right is changing in the same way.
Please tell me the minimum moves to change the string to 00…000.
If it is impossible please output “NO” in a single line.

Input:

In each line there is a string. The length of the string is shorter than 20.

Output:

For each string you have to output the minimum number or “NO” in a single line.

Sample Input:

01
011
101

Sample Output:

NO
1
2

Note:

本题由旧版NOJ导入,来源:2B

Info

NOJ

Provider NOJ

Code NOJ1965

Tags

Submitted 2

Passed 1

AC Rate 50%

Date 04/20/2019 10:03:10

Related

Nothing Yet