Problem AN
Bitmask
Masking greatly reduces the transmission of certain viruses. This is true for computer viruses as well. In order to protect binary data from infection, we must cover it up with masks!
Binary data can be represented as a string of
then the mask
The cost to produce a bitmask of length
What is the minimum cost to cover a particular piece of binary data with bitmasks? Every bit in the data must be covered by exactly one bitmask.
Input
The first line of input consists of a string of
Output
Output the minimum cost to produce the bitmasks to cover the binary data.
Sample Input 1 | Sample Output 1 |
---|---|
10101010 2 3 7 1 4 3 8 9 |
1 |
Sample Input 2 | Sample Output 2 |
---|---|
101010101111 26 51 24 79 15 46 22 79 47 84 60 100 |
37 |