Codeforces Round 491 (Div. 2)
D
Bishwock
Codeforces
1500
原题
← CE →
翻译中…

Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:

翻译中…

XX XX .X X. X. .X XX XX

翻译中…

Bishwocks don't attack any squares and can even occupy on the adjacent squares as long as they don't occupy the same square.

翻译中…

Vasya has a board with $2\times n$ squares onto which he wants to put some bishwocks. To his dismay, several squares on this board are already occupied by pawns and Vasya can't put bishwocks there. However, pawns also don't attack bishwocks and they can occupy adjacent squares peacefully.

翻译中…

Knowing the positions of pawns on the board, help Vasya to determine the maximum amount of bishwocks he can put onto the board so that they wouldn't occupy the same squares and wouldn't occupy squares with pawns.

翻译中…

Input

翻译中…

The input contains two nonempty strings that describe Vasya's board. Those strings contain only symbols "0" (zero) that denote the empty squares and symbols "X" (uppercase English letter) that denote the squares occupied by pawns. Strings are nonempty and are of the same length that does not exceed $100$.

翻译中…

Output

翻译中…

Output a single integer — the maximum amount of bishwocks that can be placed onto the given board.

翻译中…

样例

Input #1
00
00
Output #1
1
InputCopy OutputCopy
Input #2
00X00X0XXX0
0XXX0X00X00
Output #2
4
InputCopy OutputCopy
Input #3
0X0X0
0X0X0
Output #3
0
InputCopy OutputCopy
Input #4
0XXX0
00000
Output #4
2
InputCopy OutputCopy
题目信息
题号
991D
时间限制
1 s
内存限制
256 MB
标签
动态规划
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。