Problems
The cows have formed a dance team, and Farmer John is their choreographer! The team's latest and greatest dance involves
There are two types of cows in the line – Guernseys and Holsteins. As such, Farmer John has documented the dance as a sequence of length-
Unfortunately, Farmer Nhoj (who choreographs for a rival team) has sabotaged the dance and erased all but the first and last binary strings! With a big competition quickly approaching, Farmer John must waste no time in reconstructing the dance.
Given these two binary strings, help Farmer John find the minimum number of moves in the dance!
Input
The first line contains
The second line contains the first binary string.
The third line contains the last binary string.
It is guaranteed that both binary strings contain the same number of ones.
Output
The minimum number of moves in the dance.
Subtask
| # | Score | Condition |
|---|---|---|
| #1 | 10 | |
| #2 | 20 | |
| #3 | 30 | |
| #4 | 40 | |
Example #1
4 1
0111
1110
3
0111 -> 1011 -> 1101 -> 1110
Example #2
5 2
11000
00011
3
11000 -> 01100 -> 00110 -> 00011
Example #3
5 4
11000
00011
2
11000 -> 10010 -> 00011