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.


-----Examples-----
Input
00
00

Output
1
Input
00X00X0XXX0
0XXX0X00X00

Output
4
Input
0X0X0
0X0X0

Output
0
Input
0XXX0
00000

Output
2

Difficulty: MEDIUM

Solutions:
a = input()
b = input()
ct = 0
i = 0
while i < len(a):
	if i + 2 < len(a) and a[i] == '0' and (a[i + 1] == '0') and (a[i + 2] == '0') and (b[i] == '0') and (b[i + 1] == '0') and (b[i + 2] == '0'):
		ct += 2
		i += 2
	elif a[i:i + 2].count('0') + b[i:i + 2].count('0') >= 3:
		ct += 1
		i += 1
	i += 1
print(ct)


l1 = [c for c in input()]
l2 = [c for c in input()]
l = len(l1)
total = 0
for x in range(l - 1):
	if l1[x] == '0' and l1[x + 1] == '0':
		if l2[x] == '0':
			l2[x] = 'X'
			l1[x] = 'X'
			l1[x + 1] = 'X'
			total += 1
		elif l2[x + 1] == '0':
			l2[x + 1] = 'X'
			l1[x] = 'X'
			l1[x + 1] = 'X'
			total += 1
	elif l2[x] == '0' and l2[x + 1] == '0':
		if l1[x] == '0':
			l1[x] = 'X'
			l2[x] = 'X'
			l2[x + 1] = 'X'
			total += 1
		elif l1[x + 1] == '0':
			l1[x + 1] = 'X'
			l2[x] = 'X'
			l2[x + 1] = 'X'
			total += 1
print(total)


a = list(input())
b = list(input())
n = len(a)
ans = 0
for i in range(n - 1):
	if a[i + 1] == '0' and a[i] == '0' and (b[i] == '0'):
		ans += 1
		a[i] = a[i + 1] = b[i] = 'X'
	elif b[i + 1] == '0' and a[i] == '0' and (b[i] == '0'):
		ans += 1
		a[i] = b[i + 1] = b[i] = 'X'
	elif b[i + 1] == '0' and a[i + 1] == '0' and (b[i] == '0'):
		ans += 1
		a[i + 1] = b[i + 1] = b[i] = 'X'
	elif b[i + 1] == '0' and a[i + 1] == '0' and (a[i] == '0'):
		ans += 1
		a[i + 1] = b[i + 1] = a[i] = 'X'
print(ans)


def check(i):
	if s[0][i - 1] == s[1][i - 1] == s[1][i] == s[0][i] == '0':
		return 4
	elif s[0][i - 1] == s[1][i - 1] == s[1][i] == '0':
		return 0
	elif s[0][i - 1] == s[1][i - 1] == s[0][i] == '0':
		return 1
	elif s[0][i] == s[1][i] == s[0][i - 1] == '0':
		return 2
	elif s[0][i] == s[1][i] == s[1][i - 1] == '0':
		return 3
	return -1
s = [input(), input()]
n = len(s[0])
dp = [[0] * 4 for i in range(n + 1)]
for i in range(1, n):
	x = check(i)
	if x == 4 or x == 0:
		dp[i][0] = max(dp[i - 2]) + 1
	if x == 4 or x == 1:
		dp[i][1] = max(dp[i - 2]) + 1
	if x == 4 or x == 2:
		dp[i][2] = max(max(dp[i - 2]), dp[i - 1][0]) + 1
	if x == 4 or x == 3:
		dp[i][3] = max(max(dp[i - 2]), dp[i - 1][1]) + 1
	if x != 4:
		for j in range(4):
			if j != x:
				dp[i][j] = max(dp[i - 1][j], dp[i - 2][j])
print(max(dp[-2]))


import itertools
import bisect
import math
from collections import *
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def main():
	a = li()
	b = li()
	n = len(a)
	ans = 0
	for i in range(n):
		if a[i] == '0':
			ans += 1
			if i - 1 >= 0 and a[i] == b[i] == b[i - 1]:
				a[i] = b[i] = b[i - 1] = 'X'
			elif i + 1 < n and b[i] == b[i + 1] == a[i + 1] == a[i]:
				a[i] = b[i] = a[i + 1] = 'X'
			elif i + 1 < n and a[i] == b[i] == b[i + 1]:
				a[i] = b[i] = b[i + 1] = 'X'
			elif i + 1 < n and a[i] == b[i + 1] == a[i + 1]:
				a[i] = b[i + 1] = a[i + 1] = 'X'
			elif i + 1 < n and a[i] == b[i] == a[i + 1]:
				a[i] = b[i] = a[i + 1] = 'X'
			else:
				ans -= 1
	print(ans)
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def change(i, val):
	vis[0][i] = 1
	vis[1][i] = 1
	if val == 0:
		vis[0][i - 1] = 1
	elif val == 1:
		vis[1][i - 1] = 1
	elif val == 2:
		vis[0][i + 1] = 1
	else:
		vis[1][i + 1] = 1

def solve(x, y, val):
	if val < 0 or val >= n:
		return False
	if vis[x][val] == 0:
		return True
	return False
mat = list()
n = 0
for i in range(2):
	lis = input()
	n = len(lis)
	mat.append(lis)
vis = [[0] * n for i in range(2)]
for i in range(2):
	for j in range(n):
		if mat[i][j] == 'X':
			vis[i][j] = 1
ans = 0
for i in range(n):
	if vis[0][i] != 1 and vis[1][i] != 1:
		found = False
		if solve(0, i, i - 1):
			found = True
			val = 0
		elif solve(1, i, i - 1) and (not found):
			found = True
			val = 1
		elif solve(0, i, i + 1) and (not found):
			found = True
			val = 2
		elif solve(1, i, i + 1) and (not found):
			found = True
			val = 3
		if found:
			ans += 1
			change(i, val)
print(ans)


top = list(input())
bottom = list(input())
length = len(top)
count = 0
i = 0
while i + 1 < length:
	if top[i] == '0' and bottom[i] == '0':
		if top[i + 1] == '0':
			count += 1
			top[i + 1] = 'X'
			i += 1
		elif bottom[i + 1] == '0':
			count += 1
			bottom[i + 1] = 'X'
			i += 1
		else:
			i += 2
	elif top[i + 1] == '0' and bottom[i + 1] == '0':
		if top[i] == '0' or bottom[i] == '0':
			count += 1
			i += 2
		else:
			i += 1
	else:
		i += 1
print(count)


S1 = input()
S2 = input()
L = len(S1)
memo = {}

def dfs(i, p1, p2):
	if i == L:
		return 0
	key = (i, p1, p2)
	if key in memo:
		return memo[key]
	r = 0
	if S1[i] == S2[i] == '0':
		if p1 > 0 or p2 > 0:
			if p1 > 0 < p2:
				r = max(dfs(i + 1, 1, 0), dfs(i + 1, 0, 1)) + 1
			else:
				r = dfs(i + 1, 0, 0) + 1
		else:
			r = dfs(i + 1, 1, 1)
	elif S1[i] == '0':
		if p1 > 0 and p2 > 0:
			r = dfs(i + 1, 0, 0) + 1
		else:
			r = dfs(i + 1, 1, 0)
	elif S2[i] == '0':
		if p1 > 0 and p2 > 0:
			r = dfs(i + 1, 0, 0) + 1
		else:
			r = dfs(i + 1, 0, 1)
	else:
		r = dfs(i + 1, 0, 0)
	memo[key] = r
	return r
print(dfs(0, 0, 0))


board = []
board.append(input())
board.append(input())
n = len(board[0])
dp = [[0 for _ in range(n)] for _ in range(4)]
inf = float('-inf')
if board[0][0] == 'X':
	dp[0][0] = inf
	dp[2][0] = inf
if board[1][0] == 'X':
	dp[0][0] = inf
	dp[1][0] = inf
for i in range(1, n):
	prev_best = max((dp[j][i - 1] for j in range(4)))
	for j in range(4):
		dp[j][i] = prev_best
	if board[0][i] != 'X' or board[1][i] != 'X':
		dp[3][i] = max(dp[3][i], dp[0][i - 1] + 1)
	if board[0][i] != 'X' and board[1][i] != 'X':
		dp[1][i] = max(dp[1][i], dp[0][i - 1] + 1)
		dp[2][i] = max(dp[2][i], dp[0][i - 1] + 1)
		dp[3][i] = max(dp[3][i], dp[1][i - 1] + 1, dp[2][i - 1] + 1)
	if board[0][i] == 'X':
		dp[0][i] = inf
		dp[2][i] = inf
	if board[1][i] == 'X':
		dp[0][i] = inf
		dp[1][i] = inf
print(max(max((dp[i][-1] for i in range(4))), 0))


from sys import stdin, stdout
INF = float('-inf')
a = [stdin.readline().strip(), stdin.readline().strip()]
n = len(a[0])
dp = [[INF, INF, INF, INF] for i in range(n)]
if a[0][0] + a[1][0] == '00':
	dp[0][0] = 0
if a[0][0] + a[1][0] == 'X0':
	dp[0][1] = 0
if a[0][0] + a[1][0] == '0X':
	dp[0][2] = 0
if a[0][0] + a[1][0] == 'XX':
	dp[0][3] = 0
for i in range(n - 1):
	if a[0][i + 1] + a[1][i + 1] == '00':
		dp[i + 1][0] = max(max(max(dp[i][0], dp[i][1]), dp[i][2]), dp[i][3])
		dp[i + 1][1] = max(dp[i][0] + 1, dp[i + 1][1])
		dp[i + 1][2] = max(dp[i][0] + 1, dp[i + 1][2])
		dp[i + 1][3] = max(max(dp[i][1], max(dp[i][2], dp[i][0])) + 1, dp[i + 1][3])
	elif a[0][i + 1] + a[1][i + 1] == 'XX':
		dp[i + 1][3] = max(max(max(dp[i][0], dp[i][1]), dp[i][2]), dp[i][3])
	elif a[0][i + 1] + a[1][i + 1] == '0X':
		dp[i + 1][2] = max(max(max(dp[i][0], dp[i][1]), dp[i][2]), dp[i][3])
		dp[i + 1][3] = max(dp[i + 1][3], dp[i][0] + 1)
	elif a[0][i + 1] + a[1][i + 1] == 'X0':
		dp[i + 1][1] = max(max(max(dp[i][0], dp[i][1]), dp[i][2]), dp[i][3])
		dp[i + 1][3] = max(dp[i + 1][3], dp[i][0] + 1)
ans = 0
for i in range(4):
	ans = max(ans, dp[n - 1][i])
stdout.write(str(ans))


line1 = input()
line2 = input()
n = len(line1)
res = 0
ind = 0
while ind < n - 1:
	count = 0
	if line1[ind] == '0':
		count += 1
	if line1[ind + 1] == '0':
		count += 1
	if line2[ind] == '0':
		count += 1
	if line2[ind + 1] == '0':
		count += 1
	if count == 3:
		res += 1
		ind += 2
	elif count == 4:
		res += 1
		if ind + 2 <= n - 1:
			if line1[ind + 2] == '0' and line2[ind + 2] == '0':
				res += 1
				ind += 3
			else:
				ind += 2
		else:
			ind += 2
	else:
		ind += 1
print(res)


input_1 = input()
input_2 = input()
line_1 = [i for i in str(input_1)]
line_2 = [i for i in str(input_2)]
no = 0
for i in range(len(line_1) - 1):
	if line_1[i] != 'X' and line_2[i] != 'X':
		if line_1[i + 1] != 'X':
			no += 1
			line_1[i] = 'X'
			line_2[i] = 'X'
			line_1[i + 1] = 'X'
		elif line_2[i + 1] != 'X':
			no += 1
			line_1[i] = 'X'
			line_2[i] = 'X'
			line_2[i + 1] = 'X'
	elif line_1[i] != 'X' and line_1[i + 1] != 'X' and (line_2[i + 1] != 'X'):
		no += 1
		line_1[i] = 'X'
		line_1[i + 1] = 'X'
		line_2[i + 1] = 'X'
	elif line_2[i] != 'X' and line_1[i + 1] != 'X' and (line_2[i + 1] != 'X'):
		no += 1
		line_2[i] = 'X'
		line_1[i + 1] = 'X'
		line_2[i + 1] = 'X'
print(no)


import sys
import math
import collections
from pprint import pprint as pp
mod = 1000000007
MAX = 10 ** 10

def inp():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat
a = [input() for i in range(2)]
a[0] += 'XX'
a[1] += 'XX'
n = len(a[0])
ans = 0
i = 0
while i < n - 1:
	if a[0][i] != 'X' and a[1][i] != 'X':
		if a[0][i + 1] != 'X':
			ans += 1
			if a[1][i + 1] != 'X':
				if a[0][i + 2] != 'X' and a[1][i + 2] != 'X':
					ans += 1
					i += 3
				else:
					i += 2
			else:
				i += 2
		elif a[1][i + 1] != 'X':
			ans += 1
			i += 2
		else:
			i += 1
	elif a[0][i] != 'X' or a[1][i] != 'X':
		if a[0][i + 1] != 'X' and a[1][i + 1] != 'X':
			ans += 1
			i += 2
		else:
			i += 1
	else:
		i += 1
print(ans)


arr1 = input()
arr2 = input()

def replace(arr, index, element):
	for i in range(len(arr)):
		if i == index:
			arr[i] = element
		else:
			continue
	return arr
arr1 = list(arr1)
arr2 = list(arr2)
c = 0
for i in range(len(arr1) - 1):
	if arr1[i] == '0' and arr2[i] == '0' and (arr2[i + 1] == '0'):
		c += 1
		arr1 = replace(arr1, i, 'X')
		arr2 = replace(arr2, i, 'X')
		arr2 = replace(arr2, i + 1, 'X')
	elif arr1[i] == '0' and arr1[i + 1] == '0' and (arr2[i + 1] == '0'):
		c += 1
		arr1 = replace(arr1, i, 'X')
		arr1 = replace(arr1, i + 1, 'X')
		arr2 = replace(arr2, i + 1, 'X')
	elif arr1[i] == '0' and arr1[i + 1] == '0' and (arr2[i] == '0'):
		c += 1
		arr1 = replace(arr1, i, 'X')
		arr1 = replace(arr1, i + 1, 'X')
		arr2 = replace(arr2, i, 'X')
	elif arr1[i + 1] == '0' and arr2[i + 1] == '0' and (arr2[i] == '0'):
		c += 1
		arr1 = replace(arr1, i + 1, 'X')
		arr2 = replace(arr2, i + 1, 'X')
		arr2 = replace(arr2, i, 'X')
print(c)


from math import inf
a = [0, 0]
a[0] = [str(c) for c in list(input().strip())]
a[1] = [str(X) for X in list(input().strip())]
an = [-inf, -inf, -inf]
if a[0][0] == a[1][0] == '0':
	an[0] = 0
elif a[0][0] != a[1][0]:
	an[1] = 0
x = 0
for i in range(1, len(a[0])):
	if an[0] == 0:
		if a[0][i] == a[1][i] == '0':
			x += 1
			an = [-inf, 0, -inf]
		elif a[0][i] != a[1][i]:
			x += 1
			an = [-inf] * 3
		else:
			an = [-inf, -inf, -inf]
	elif an[1] == 0:
		if a[0][i] == a[1][i] == '0':
			x += 1
			an = [-inf, -inf, -inf]
		elif a[0][i] != a[1][i]:
			pass
		else:
			an = [-inf, -inf, -inf]
	elif a[0][i] == a[1][i] == '0':
		an = [0, -inf, -inf]
	elif a[0][i] != a[1][i]:
		an = [-inf, 0, -inf]
	else:
		an = [-inf, -inf, -inf]
print(x)


s1 = list(input())
s2 = list(input())
s1 = ['X'] + s1 + ['X']
s2 = ['X'] + s2 + ['X']
ans = 0
for i in range(1, len(s1) - 1):
	if s1[i] == '0' and s2[i] == '0':
		if s1[i - 1] == '0':
			ans += 1
			s1[i] = 'X'
			s2[i] = 'X'
			s1[i - 1] = 'X'
		elif s2[i - 1] == '0':
			ans += 1
			s1[i] = 'X'
			s2[i] = 'X'
			s2[i - 1] = 'X'
		elif s1[i + 1] == '0':
			ans += 1
			s1[i] = 'X'
			s2[i] = 'X'
			s1[i + 1] = 'X'
		elif s2[i + 1] == '0':
			ans += 1
			s1[i] = 'X'
			s2[i] = 'X'
			s2[i + 1] = 'X'
print(ans)


s = [input() for i in range(2)]
n = len(s[0])

def divconq(a, b):
	if a + 1 >= b:
		return 0
	for i in range(a, b):
		sq1 = [s[0][i], s[1][i]]
		if sq1 == ['X', 'X']:
			return divconq(a, i) + divconq(i + 1, b)
	for i in range(a, b - 1):
		sq2 = [s[0][i], s[0][i + 1], s[1][i], s[1][i + 1]]
		if sq2 == ['X', 'X', '0', '0'] or sq2 == ['0', '0', 'X', 'X']:
			return divconq(a, i + 1) + divconq(i + 1, b)
		if sq2 == ['X', '0', '0', 'X'] or sq2 == ['0', 'X', 'X', '0']:
			return divconq(a, i + 1) + divconq(i + 1, b)
	for i in range(a, b):
		sq1 = [s[0][i], s[1][i]]
		if sq1 == ['X', '0'] or sq1 == ['0', 'X']:
			if i == a:
				return 1 + divconq(i + 2, b)
			if i == b - 1:
				return divconq(a, i - 1) + 1
			return max(divconq(a, i - 1) + 1 + divconq(i + 1, b), divconq(a, i) + 1 + divconq(i + 2, b))
	return (b - a) // 3 * 2 + ((b - a) % 3 == 2)
print(divconq(0, n))


a = [['X'] + list(map(str, input())) + ['X'], ['X'] + list(map(str, input())) + ['X']]
n = len(a[0])
ans = 0
for i in range(1, n - 1):
	if a[0][i] == a[1][i] == '0':
		if a[0][i - 1] == '0':
			a[0][i - 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			ans += 1
		elif a[1][i - 1] == '0':
			a[1][i - 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			ans += 1
		elif a[0][i + 1] == '0':
			a[0][i + 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			ans += 1
		elif a[1][i + 1] == '0':
			a[1][i + 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			ans += 1
print(ans)


s = [input(), input()]
pc = [[s[0][i], s[1][i]].count('0') for i in range(len(s[0]))]
ans = 0
for i in range(len(pc) - 1):
	if pc[i] >= 2 and pc[i + 1] >= 1:
		ans += 1
		pc[i] -= 2
		pc[i + 1] -= 1
	elif pc[i] >= 1 and pc[i + 1] >= 2:
		ans += 1
		pc[i] -= 1
		pc[i + 1] -= 2
print(ans)


in1 = input()
in2 = input()
s1 = []
s2 = []
for i in range(len(in1)):
	s1.append(in1[i])
for i in range(len(in2)):
	s2.append(in2[i])
n = 0
for i in range(len(s1) - 1):
	t = 0
	a = s1[i]
	b = s1[i + 1]
	c = s2[i]
	d = s2[i + 1]
	if s1[i] == '0':
		t += 1
		s1[i] = 'X'
	if s2[i] == '0':
		t += 1
		s2[i] = 'X'
	if s1[i + 1] == '0':
		t += 1
		s1[i + 1] = 'X'
	if s2[i + 1] == '0':
		if t != 3:
			s2[i + 1] = 'X'
			t += 1
	if t >= 3:
		n += 1
	else:
		s1[i] = a
		s1[i + 1] = b
		s2[i] = c
		s2[i + 1] = d
print(n)


S = [str(input()) for i in range(2)]
S[0] = S[0].replace('X', '1')
S[1] = S[1].replace('X', '1')
n = len(S[0])
if n == 1:
	print(0)
	exit()
INF = 10 ** 18
from collections import defaultdict
dp = defaultdict(lambda : -INF)
for i in range(0, 2):
	for j in range(0, 2):
		dp[i, j] = -INF
dp[int(S[0][0]), int(S[1][0])] = 0
for i in range(1, n):
	nx = defaultdict(lambda : -INF)
	for j in range(0, 2):
		for k in range(0, 2):
			nx[int(S[0][i]), int(S[1][i])] = max(nx[int(S[0][i]), int(S[1][i])], dp[j, k])
	for j in range(0, 2):
		for k in range(0, 2):
			if dp[j, k] == -INF:
				continue
			if j == 0 and k == 0:
				if S[0][i] == '1' and S[1][i] != '1':
					nx[1, 1] = max(nx[1, 1], dp[j, k] + 1)
				if S[0][i] != '1' and S[1][i] == '1':
					nx[1, 1] = max(nx[1, 1], dp[j, k] + 1)
				if S[0][i] != '1' and S[1][i] != '1':
					nx[1, 0] = max(nx[1, 0], dp[j, k] + 1)
					nx[0, 1] = max(nx[0, 1], dp[j, k] + 1)
					nx[1, 1] = max(nx[1, 1], dp[j, k] + 1)
			if j == 0 and k == 1:
				if S[0][i] != '1' and S[1][i] != '1':
					nx[1, 1] = max(nx[1, 1], dp[j, k] + 1)
			if j == 1 and k == 0:
				if S[0][i] != '1' and S[1][i] != '1':
					nx[1, 1] = max(nx[1, 1], dp[j, k] + 1)
	dp = nx
ans = -INF
for (k, v) in dp.items():
	ans = max(ans, v)
print(ans)


first = input()
second = input()
n = len(first)
up = 0
dw = 0
poss = 0
for i in range(n):
	if first[i] == '0' and second[i] == '0':
		up += 1
		dw += 1
		if up > dw:
			up -= 2
			dw -= 1
			poss += 1
		elif dw > up:
			dw -= 2
			up -= 1
			poss += 1
	elif first[i] == '0' and second[i] == 'X':
		both = min(up, dw)
		if both >= 3:
			poss += both // 3 * 2
			up %= 3
			dw %= 3
		up += 1
		if dw > 1 and up >= 1:
			poss += 1
			up = 1
			dw = 0
		elif dw >= 1 and up > 1:
			poss += 1
			up = min(up - 2, 1)
			dw = 0
		else:
			up = 1
			dw = 0
	elif first[i] == 'X' and second[i] == '0':
		both = min(up, dw)
		if both >= 3:
			poss += both // 3 * 2
			up %= 3
			dw %= 3
		dw += 1
		if up > 1 and dw >= 1:
			poss += 1
			dw = 1
			up = 0
		elif up >= 1 and dw > 1:
			poss += 1
			dw = min(dw - 2, 1)
			up = 0
		else:
			dw = 1
			up = 0
	else:
		both = min(up, dw)
		if both >= 3:
			poss += both // 3 * 2
			up %= 3
			dw %= 3
		if max(up, dw) > 1 and min(up, dw) >= 1:
			poss += 1
		up = 0
		dw = 0
both = min(up, dw)
if both >= 3:
	poss += both // 3 * 2
	up %= 3
	dw %= 3
if max(up, dw) > 1 and min(up, dw) >= 1:
	poss += 1
print(poss)


A = list(input())
B = list(input())
n = 0
for i in range(0, len(A) - 1):
	if A[i] == '0' and B[i] == '0':
		if A[i + 1] == '0':
			A[i + 1] = 'X'
			A[i] = 'X'
			B[i] = 'X'
			n += 1
		elif B[i + 1] == '0':
			B[i + 1] = 'X'
			A[i] = 'X'
			B[i] = 'X'
			n += 1
	elif A[i + 1] == '0' and B[i + 1] == '0':
		if A[i] == '0':
			A[i + 1] = 'X'
			B[i + 1] = 'X'
			A[i] = 'X'
			n += 1
		elif B[i] == '0':
			A[i + 1] = 'X'
			B[i + 1] = 'X'
			B[i] = 'X'
			n += 1
print(n)


list1 = list(input())
list2 = list(input())
n = len(list1)
count = 0
for i in range(n):
	if list1[i] == '0':
		if i > 0 and list1[i - 1] == '0' and (list2[i - 1] == '0'):
			count += 1
			list1[i] = 'X'
			list2[i - 1] = 'x'
			list1[i - 1] = 'x'
		elif i > 0 and list2[i] == '0' and (list2[i - 1] == '0'):
			count += 1
			list1[i] = 'x'
			list2[i] = 'x'
			list2[i - 1] = 'x'
		elif i > 0 and list2[i] == '0' and (list1[i - 1] == '0'):
			count += 1
			list1[i] = 'x'
			list2[i] = 'x'
			list1[i - 1] = 'x'
		elif i < n - 1 and list1[i] == '0' and (list2[i] == '0') and (list2[i + 1] == '0'):
			count += 1
			list1[i] = 'x'
			list2[i] = 'x'
			list2[i + 1] = 'x'
	i += 1
print(count)


b = [list(input()) for _ in range(2)]
n = len(b[0])
ans = 0
a = []
for i in range(n):
	ai = 0
	if b[0][i] == '0':
		ai += 1
	if b[1][i] == '0':
		ai += 1
	a.append(ai)
prv = 0
for i in range(n):
	if a[i] == 0:
		prv = 0
	elif a[i] == 1:
		if prv == 2:
			ans += 1
			prv = 0
		else:
			prv = 1
	elif a[i] == 2:
		if prv == 2:
			ans += 1
			prv = 1
		elif prv == 1:
			ans += 1
			prv = 0
		else:
			prv = 2
print(ans)


def f(ch):
	if ch == '0':
		return 0
	else:
		return 1
U = [[f(i) for i in list(input())], [f(i) for i in list(input())]]
i = 0
size = len(U[0])
ans = 0
while i + 1 < size:
	if U[0][i] + U[0][i + 1] + U[1][i] + U[1][i + 1] > 1:
		i += 1
		continue
	elif U[0][i] + U[0][i + 1] + U[1][i] + U[1][i + 1] == 1:
		U[0][i] = 1
		U[0][i + 1] = 1
		U[1][i] = 1
		U[1][i + 1] = 1
		ans += 1
	else:
		U[0][i] = 1
		U[0][i + 1] = 1
		U[1][i] = 1
		ans += 1
	i += 1
print(ans)


try:
	while True:
		str1 = input()
		str1 = 'X' + str1 + 'X'
		str2 = input()
		str2 = 'X' + str2 + 'X'
		cnt = [[str1[i], str2[i]].count('0') for i in range(len(str1))]
		ans = 0
		for i in range(len(str1) - 2):
			if cnt[i] + cnt[i + 1] > 2:
				cnt[i + 1] = cnt[i] + cnt[i + 1] - 3
				ans += 1
		print(ans)
except Exception as e:
	pass


def solution():
	l = []
	s = input()
	s1 = input()
	l.append(s)
	l.append(s1)
	ans = 0
	cur = 0
	empty = 0
	for i in range(len(s)):
		cur = 0
		if l[1][i] == '0':
			cur += 1
		if l[0][i] == '0':
			cur += 1
		empty += cur
		if empty >= 3:
			empty -= 3
			ans += 1
		else:
			empty = cur
	print(ans)
solution()


l1 = list(str(input()))
l2 = list(str(input()))
n = len(l1)
count = 0
for i in range(n - 1):
	if l1[i] == '0' and l1[i + 1] == '0':
		if l2[i] == '0':
			(l1[i], l1[i + 1], l2[i]) = ('X', 'X', 'X')
			count += 1
		elif l2[i + 1] == '0':
			(l1[i], l1[i + 1], l2[i + 1]) = ('X', 'X', 'X')
			count += 1
	if l2[i] == '0' and l2[i + 1] == '0':
		if l1[i] == '0':
			(l2[i], l2[i + 1], l1[i]) = ('X', 'X', 'X')
			count += 1
		elif l1[i + 1] == '0':
			(l2[i], l2[i + 1], l1[i + 1]) = ('X', 'X', 'X')
			count += 1
print(count)


s = [list(input()), list(input())]
ans = 0
for i in range(len(s[0]) - 1):
	if s[1][i] == s[0][i] == '0':
		if s[0][i + 1] == '0':
			ans += 1
			s[0][i] = s[0][i + 1] = s[1][i] = 'X'
		elif s[1][i + 1] == '0':
			ans += 1
			s[0][i] = s[1][i + 1] = s[1][i] = 'X'
	if s[1][i + 1] == s[0][i + 1] == '0':
		if s[0][i] == '0':
			ans += 1
			s[0][i] = s[0][i + 1] = s[1][i + 1] = 'X'
		elif s[1][i] == '0':
			ans += 1
			s[1][i + 1] = s[0][i + 1] = s[1][i] = 'X'
print(ans)


s = [i for i in input()]
z = [i for i in input()]
c = 0
for i in range(len(s) - 1):
	if s[i] == '0' and z[i] == '0' and (s[i + 1] == '0'):
		c += 1
		s[i] = 'x'
		z[i] = 'x'
		s[i + 1] = 'x'
	elif s[i] == '0' and z[i + 1] == '0' and (s[i + 1] == '0'):
		c += 1
		s[i] = 'x'
		z[i + 1] = 'x'
		s[i + 1] = 'x'
	elif z[i] == '0' and z[i + 1] == '0' and (s[i + 1] == '0'):
		c += 1
		z[i] = 'x'
		z[i + 1] = 'x'
		s[i + 1] = 'x'
	elif z[i] == '0' and z[i + 1] == '0' and (s[i] == '0'):
		c += 1
		z[i] = 'x'
		z[i + 1] = 'x'
		s[i] = 'x'
print(c)


s = []
counter = 0

def checar():
	global s
	global counter
	for x in range(len(s[0])):
		if s[0][x] == '0':
			if s[1][x] == '0':
				if x > 0 and s[1][x - 1] == '0':
					s[0][x] = 'X'
					s[1][x] = 'X'
					s[1][x - 1] = 'X'
					counter += 1
					continue
				elif x < len(s[0]) - 1 and s[1][x + 1] == '0':
					s[0][x] = 'X'
					s[1][x] = 'X'
					s[1][x + 1] = 'X'
					counter += 1
					continue
				elif x < len(s[0]) - 1 and s[0][x + 1] == '0':
					s[0][x] = 'X'
					s[1][x] = 'X'
					s[0][x + 1] = 'X'
					counter += 1
					continue
			elif x < len(s[0]) - 1 and s[0][x + 1] == '0' and (s[1][x + 1] == '0'):
				s[0][x] = 'X'
				s[0][x + 1] = 'X'
				s[1][x + 1] = 'X'
				counter += 1
				continue
s.append(list(input()))
s.append(list(input()))
checar()
print(counter)


l1 = list(input().strip())
l2 = list(input().strip())
r = 0
for i in range(len(l1) - 1):
	if l1[i] == '0' and l2[i] == '0':
		if l2[i + 1] == '0':
			l1[i] = 'X'
			l2[i] = 'X'
			l2[i + 1] = 'X'
			r += 1
		elif l1[i + 1] == '0':
			l1[i] = 'X'
			l2[i] = 'X'
			l1[i + 1] = 'X'
			r += 1
	elif l1[i] == '0':
		if l1[i + 1] == '0' and l2[i + 1] == '0':
			l1[i] = 'X'
			l1[i + 1] = 'X'
			l2[i + 1] = 'X'
			r += 1
	elif l2[i] == '0':
		if l1[i + 1] == '0' and l2[i + 1] == '0':
			l2[i] = 'X'
			l1[i + 1] = 'X'
			l2[i + 1] = 'X'
			r += 1
print(r)


sa = input()
sb = input()
a = []
b = []
k = 0
for i in range(0, len(sa)):
	a.append(sa[i])
for i in range(0, len(sb)):
	b.append(sb[i])
for i in range(0, len(sa) - 1):
	if a[i] == '0' and a[i + 1] == '0':
		if b[i] == '0':
			k += 1
			a[i] = a[i + 1] = 'X'
			b[i] = 'X'
		elif b[i + 1] == '0':
			k += 1
			a[i] = a[i + 1] = 'X'
			b[i + 1] = 'X'
	elif b[i] == '0' and b[i + 1] == '0':
		if a[i] == '0':
			k += 1
			b[i] = b[i + 1] = 'X'
			a[i] = 'X'
		elif a[i + 1] == '0':
			k += 1
			b[i] = b[i + 1] = 'X'
			a[i + 1] = 'X'
print(k)


a = input()
b = input()
empties = [x.count('0') for x in zip(a, b)]
cnt = 0
can = 0
for emp in empties:
	can += emp
	if can >= 3:
		can -= 3
		cnt += 1
	else:
		can = emp
print(cnt)


grid = []
grid.append(input().strip())
grid.append(input().strip())
temp = []
for char in grid[0]:
	temp.append(char)
grid[0] = temp
temp = []
for char in grid[1]:
	temp.append(char)
grid[1] = temp
n = len(grid[0])
count = 0
for i in range(n - 1):
	curr_grid = []
	curr_grid.append(grid[0][i])
	curr_grid.append(grid[0][i + 1])
	curr_grid.append(grid[1][i])
	curr_grid.append(grid[1][i + 1])
	x = curr_grid.count('X')
	if x == 1:
		count += 1
		grid[0][i] = 'X'
		grid[0][i + 1] = 'X'
		grid[1][i] = 'X'
		grid[1][i + 1] = 'X'
	elif x == 0:
		count += 1
		grid[0][i] = 'X'
		grid[1][i] = 'X'
		grid[1][i + 1] = 'X'
print(count)


(chess, ans) = ([list(input()) for i in range(2)], 0)
for i in range(len(chess[0])):
	if chess[0][i] == chess[1][i] == '0':
		if i > 0:
			if chess[0][i - 1] == '0':
				ans += 1
				chess[0][i] = chess[1][i] = chess[0][i - 1] = 'X'
			elif chess[1][i - 1] == '0':
				chess[0][i] = chess[1][i] = chess[1][i - 1] = 'X'
				ans += 1
	if chess[0][i] == chess[1][i] == '0':
		if i < len(chess[0]) - 1:
			if chess[0][i + 1] == '0':
				ans += 1
				chess[0][i] = chess[1][i] = chess[0][i + 1] = 'X'
			elif chess[1][i + 1] == '0':
				chess[0][i] = chess[1][i] = chess[1][i + 1] = 'X'
				ans += 1
print(ans)


F = [i for i in input()]
S = [i for i in input()]
N = len(F)
if N == 1:
	print(0)
	exit()
Ans = 0
for i in range(N - 1):
	if S[i] == '0' and F[i] == '0':
		if S[i + 1] == '0':
			Ans += 1
			S[i] = 'X'
			S[i + 1] = 'X'
			F[i] = 'X'
		elif F[i + 1] == '0':
			Ans += 1
			S[i] = 'X'
			S[i] = 'X'
			F[i + 1] = 'X'
	elif S[i] == '0':
		if S[i + 1] == '0' and F[i + 1] == '0':
			Ans += 1
			S[i] = 'X'
			S[i + 1] = 'X'
			F[i + 1] = 'X'
	elif F[i] == '0':
		if S[i + 1] == '0' and F[i + 1] == '0':
			Ans += 1
			S[i] = 'X'
			S[i + 1] = 'X'
			F[i + 1] = 'X'
i = N - 1
if S[i] == '0' and F[i] == '0':
	if S[i - 1] == '0':
		Ans += 1
	elif F[i - 1] == '0':
		Ans += 1
elif S[i] == '0':
	if S[i - 1] == '0' and F[i - 1] == '0':
		Ans += 1
elif F[i] == '0':
	if S[i - 1] == '0' and F[i - 1] == '0':
		Ans += 1
print(Ans)


def go():
	matrix = []
	matrix.append(list((i for i in input())))
	matrix.append(list((i for i in input())))
	c = 0
	for i in range(len(matrix[0]) - 1):
		if matrix[0][i] == '0' and matrix[1][i] == '0':
			if matrix[0][i + 1] == '0':
				matrix[0][i] = 'X'
				matrix[1][i] = 'X'
				matrix[0][i + 1] = 'X'
				c += 1
			elif matrix[1][i + 1] == '0':
				matrix[0][i] = 'X'
				matrix[1][i] = 'X'
				matrix[1][i + 1] = 'X'
				c += 1
		elif matrix[0][i] == '0':
			if matrix[0][i + 1] == '0' and matrix[1][i + 1] == '0':
				matrix[0][i] = 'X'
				matrix[0][i + 1] = 'X'
				matrix[1][i + 1] = 'X'
				c += 1
		elif matrix[1][i] == '0':
			if matrix[0][i + 1] == '0' and matrix[1][i + 1] == '0':
				matrix[1][i] = 'X'
				matrix[0][i + 1] = 'X'
				matrix[1][i + 1] = 'X'
				c += 1
	return c
print(go())


from math import *
a = []
s = input()
n = len(s)
a.append(s)
s = input()
a.append(s)
cur = 0
emp = 0
ans = 0
for i in range(n):
	cur = 0
	if a[0][i] == '0':
		cur += 1
	if a[1][i] == '0':
		cur += 1
	emp += cur
	if emp >= 3:
		emp -= 3
		ans += 1
	else:
		emp = cur
print(ans)


a = []
a.append(input())
a.append(input())
dp = [-200] * 4
dp[1 * (a[0][0] == 'X') + 2 * (a[1][0] == 'X')] = 0
for i in range(1, len(a[0])):
	odp = dp
	dp = [-200] * 4
	state = 1 * (a[0][i] == 'X') + 2 * (a[1][i] == 'X')
	for last_state in range(4):
		dp[state] = max(dp[state], odp[last_state])
		if last_state != 3 and state == 0:
			dp[3] = max(dp[3], odp[last_state] + 1)
		if last_state == 0:
			if ~state & 1:
				dp[state + 1] = max(dp[state + 1], odp[last_state] + 1)
			if ~state & 2:
				dp[state + 2] = max(dp[state + 2], odp[last_state] + 1)
print(max(max(dp[0], dp[1]), max(dp[2], dp[3])))


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
import random

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def primeFactorsCount(n):
	cnt = 0
	while n % 2 == 0:
		cnt += 1
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			cnt += 1
			n = n // i
	if n > 2:
		cnt += 1
	return cnt

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	i = 2
	while i * i <= n:
		if primes[i] == True:
			for j in range(i * i, n + 1, i):
				primes[j] = False
		i += 1
	pr = []
	for i in range(0, n + 1):
		if primes[i]:
			pr.append(i)
	return pr

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s

def chk1(i):
	if i != n - 1 and l1[i] == l2[i] == l2[i + 1] == '0':
		l1[i] = l2[i] = l2[i + 1] = 'X'
		return True
	return False

def chk2(i):
	if i != n - 1 and l1[i] == l1[i + 1] == l2[i] == '0':
		l1[i] = l1[i + 1] = l2[i] = 'X'
		return True
	return False

def chk3(i):
	if i != n - 1 and l1[i] == l1[i + 1] == l2[i + 1] == '0':
		l1[i] = l1[i + 1] = l2[i + 1] = 'X'
		return True
	return False

def chk4(i):
	if i != n - 1 and l2[i + 1] == l1[i + 1] == l2[i] == '0':
		l1[i] = l1[i + 1] = l2[i] = 'X'
		return True
	return False

def check1(i):
	if i <= n - 3 and l1[i:i + 3] == l2[i:i + 3] == ['0', '0', '0']:
		for j in range(i, i + 3):
			l1[j] = l2[j] = 'X'
		return True

def check2(i):
	if chk1(i) or chk2(i) or chk3(i) or chk4(i):
		return True
	return False
l1 = list(input())
l2 = list(input())
n = len(l1)
i = 0
ans = 0
while i < n:
	if check1(i):
		ans += 2
		i += 3
	elif check2(i):
		ans += 1
		i += 2
	else:
		i += 1
print(ans)


a2 = input()
b2 = input()
a = []
b = []
for i in range(len(a2)):
	a.append(a2[i])
	b.append(b2[i])
k = 0
for i in range(len(a)):
	if i == 0 and len(a) > 1:
		if a[0] == '0' and b[0] == '0' and (a[1] == '0'):
			a[0] = 'X'
			b[0] = 'X'
			a[1] = 'X'
			k += 1
		elif a[0] == '0' and b[0] == '0' and (b[1] == '0'):
			a[0] = 'X'
			b[0] = 'X'
			b[1] = 'X'
			k += 1
	elif i == len(a) - 1 and len(a) > 1:
		if a[i] == '0' and b[i] == '0' and (a[i - 1] == '0'):
			a[i] = 'X'
			b[i] = 'X'
			a[i - 1] = 'X'
			k += 1
		elif a[i] == '0' and b[i] == '0' and (b[i - 1] == '0'):
			a[i] = 'X'
			b[i] = 'X'
			b[i - 1] = 'X'
			k += 1
	elif len(a) > 1:
		if a[i] == '0' and b[i] == '0' and (a[i - 1] == '0'):
			a[i] = 'X'
			b[i] = 'X'
			a[i - 1] = 'X'
			k += 1
		elif a[i] == '0' and b[i] == '0' and (b[i - 1] == '0'):
			a[i] = 'X'
			b[i] = 'X'
			b[i - 1] = 'X'
			k += 1
		elif a[i] == '0' and b[i] == '0' and (a[i + 1] == '0'):
			a[i] = 'X'
			b[i] = 'X'
			a[i + 1] = 'X'
			k += 1
		elif a[i] == '0' and b[i] == '0' and (b[i + 1] == '0'):
			a[i] = 'X'
			b[i] = 'X'
			b[i + 1] = 'X'
			k += 1
	else:
		k = 0
print(k)


(*l,) = map(list, zip(input(), input()))
a = 0
for i in range(1, len(l)):
	if l[i - 1] == ['0', '0']:
		if l[i] == ['0', '0']:
			a += 1
			l[i] = ['0', 'X']
		elif l[i] == ['0', 'X'] or l[i] == ['X', '0']:
			a += 1
			l[i] = ['X', 'X']
	elif l[i - 1] == ['0', 'X'] or l[i - 1] == ['X', '0']:
		if l[i] == ['0', '0']:
			a += 1
			l[i] = ['X', 'X']
print(a)


a = list(input())
b = list(input())
n = len(a)
r = 0
for i in range(n - 1):
	if a[i] == '0' and b[i] == '0':
		if a[i + 1] == '0':
			(a[i + 1], a[i], b[i]) = ('x', 'x', 'x')
			r += 1
		elif b[i + 1] == '0':
			(b[i + 1], a[i], b[i]) = ('x', 'x', 'x')
			r += 1
	elif a[i + 1] == '0' and b[i + 1] == '0':
		if a[i] == '0':
			(a[i + 1], b[i + 1], a[i]) = ('x', 'x', 'x')
			r += 1
		elif b[i] == '0':
			(a[i + 1], b[i + 1], b[i]) = ('x', 'x', 'x')
			r += 1
print(r)


TN = 1

def solution():
	s1 = list(input())
	s2 = list(input())
	ans = 0
	for i in range(len(s1)):
		if s1[i] == '0' and s2[i] == '0' and (i - 1 >= 0) and (s2[i - 1] == '0'):
			s1[i] = 'X'
			s2[i] = 'X'
			s2[i - 1] = 'X'
			ans += 1
		elif s1[i] == '0' and s2[i] == '0' and (i - 1 >= 0) and (s1[i - 1] == '0'):
			s1[i] = 'X'
			s2[i] = 'X'
			s1[i - 1] = 'X'
			ans += 1
		elif s1[i] == '0' and s2[i] == '0' and (i + 1 < len(s1)) and (s2[i + 1] == '0'):
			s1[i] = 'X'
			s2[i] = 'X'
			s2[i + 1] = 'X'
			ans += 1
		elif s1[i] == '0' and s2[i] == '0' and (i + 1 < len(s1)) and (s1[i + 1] == '0'):
			s1[i] = 'X'
			s2[i] = 'X'
			s1[i + 1] = 'X'
			ans += 1
	print(ans)
while TN != 0:
	solution()
	TN -= 1


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
cat = ''.join
catn = '\n'.join
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
figures = [((0, 0), (0, 1), (1, 0)), ((0, 0), (0, 1), (1, 1)), ((0, 1), (1, 0), (1, 1)), ((0, 0), (1, 0), (1, 1))]
board = []
for _ in range(2):
	s = rl()
	board.append(list(s))
n = len(board[0])
ans = 0
for j in range(n - 1):
	for fig in figures:
		ok = 1
		for (fi, fj) in fig:
			if board[fi][j + fj] == 'X':
				ok = 0
				break
		if not ok:
			continue
		ans += 1
		for (fi, fj) in fig:
			board[fi][j + fj] = 'X'
print(ans)


f = lambda x: int(x == '0')
arr = [c1 + c2 for (c1, c2) in zip(map(f, input()), map(f, input()))]
res = 0
for i in range(len(arr) - 1):
	if arr[i] + arr[i + 1] >= 3:
		res += 1
		(arr[i], arr[i + 1]) = (0, arr[i] + arr[i + 1] - 3)
print(res)


a = list(input())
b = list(input())
c = []
for i in range(len(a)):
	c.append(int(a[i] == '0') + int(b[i] == '0'))
d = 0
for i in range(len(a) - 1):
	if c[i] == 2 and c[i + 1] == 2:
		c[i] = 0
		c[i + 1] = 1
		d = d + 1
	elif c[i] == 1 and c[i + 1] == 2:
		c[i] = 0
		c[i + 1] = 0
		d = d + 1
	if c[i] == 2 and c[i + 1] == 1:
		c[i] = 0
		c[i + 1] = 0
		d = d + 1
print(d)


import sys
input = sys.stdin.readline
MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input().strip('\n'))
si = lambda : input().strip('\n')
dgl = lambda : list(map(int, input().strip('\n')))
f = lambda : map(int, input().strip('\n').split())
il = lambda : list(map(int, input().strip('\n').split()))
ls = lambda : list(input().strip('\n'))
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(1):
	l = [ls() for i in range(2)]
	n = len(l[0])
	ans = 0
	for i in range(1, n):
		if l[0][i - 1] == '0' and l[1][i - 1] == '0':
			if l[0][i] == '0':
				ans += 1
				l[0][i] = 'X'
			elif l[1][i] == '0':
				ans += 1
				l[1][i] = 'X'
		elif l[0][i] == '0' and l[1][i] == '0':
			if l[0][i - 1] == '0' or l[1][i - 1] == '0':
				ans += 1
				(l[0][i], l[1][i]) = ('X', 'X')
	print(ans)


from collections import Counter
s1 = input()
s2 = input()
rdymax = False
rdymin = False
total = 0
for i in range(len(s1)):
	if s1[i] == s2[i] == 'X':
		rdymax = False
		rdymin = False
		continue
	if (s1[i] == '0') ^ (s2[i] == '0'):
		if rdymax:
			total += 1
			rdymax = False
			continue
		rdymin = True
		continue
	if rdymin:
		total += 1
		rdymin = False
		rdymax = False
		continue
	if rdymax:
		total += 1
		rdymin = True
		rdymax = False
		continue
	rdymax = True
print(total)


def f(a, b, c, d):
	(x, y, z, w) = (0, 0, 0, 0)
	if a == '0':
		x += 1
	if b == '0':
		y += 1
	if c == '0':
		z += 1
	if d == '0':
		w += 1
	return x + y + z + w
a = list(input())
b = list(input())
c = 0
for i in range(len(a) - 1):
	if f(a[i], a[i + 1], b[i], b[i + 1]) == 3:
		(a[i], a[i + 1], b[i], b[i + 1]) = ('X', 'X', 'X', 'X')
		c += 1
	elif f(a[i], a[i + 1], b[i], b[i + 1]) == 4:
		(a[i], a[i + 1], b[i]) = ('X', 'X', 'X')
		c += 1
print(c)


s = input()
t = input()
m = [list(s), list(t)]
i = 0
ans = 0
while i < len(s) - 1:
	indexes = [(0, i), (1, i), (0, i + 1), (1, i + 1)]
	for j in range(3, -1, -1):
		flag = True
		for k in range(4):
			if k != j:
				x = indexes[k]
				if m[x[0]][x[1]] == 'X':
					flag = False
					break
		if flag:
			for k in range(4):
				if k != j:
					x = indexes[k]
					m[x[0]][x[1]] = 'X'
			ans += 1
			break
	i += 1
print(ans)


topboard = list(input())
botboard = list(input())
bish = 0
left = 0
while left + 1 < len(topboard):
	if topboard[left] == '0' and botboard[left] == '0':
		if topboard[left + 1] == '0':
			bish += 1
			topboard[left] = 'X'
			topboard[left + 1] = 'X'
			botboard[left] = 'X'
		elif botboard[left + 1] == '0':
			bish += 1
			topboard[left] = 'X'
			botboard[left] = 'X'
			botboard[left + 1] = 'X'
	elif topboard[left + 1] == '0' and botboard[left + 1] == '0':
		if topboard[left] == '0':
			bish += 1
			topboard[left] = 'X'
			topboard[left + 1] = 'X'
			botboard[left + 1] = 'X'
		elif botboard[left] == '0':
			bish += 1
			topboard[left + 1] = 'X'
			botboard[left] = 'X'
			botboard[left + 1] = 'X'
	left += 1
print(bish)


board = []
board.append(list(input()))
board.append(list(input()))
n = len(board[0])
best = 0
best_f_under = 0
best_f_over = 0
best_f_both = 0
for i in range(1, n):
	a_1 = 0
	a_2 = 0
	a_3 = 0
	a_4 = 0
	if board[0][i - 1] == '0' and board[1][i - 1] == '0':
		if board[0][i] == '0':
			a_1 = 1
		if board[1][i] == '0':
			a_4 = 1
	if board[0][i] == '0' and board[1][i] == '0':
		if board[0][i - 1] == '0':
			a_2 = 1
		if board[1][i - 1] == '0':
			a_3 = 1
	best_temp = max(a_2 + best_f_over, a_3 + best_f_under)
	best_f_under_temp = a_1 + best_f_both
	best_f_over_temp = a_4 + best_f_both
	best_f_both = max(best_f_under, best_f_over, best, best_f_both)
	best = best_temp
	best_f_under = max(best_f_under_temp, best_f_both)
	best_f_over = max(best_f_over_temp, best_f_both)
print(max(best, best_f_over, best_f_under, best_f_both))


row1 = input()
row2 = input()
n = len(row1)
flag = None
for i in range(n):
	if row1[i] == '0' and row2[i] == '0':
		flag = 1
		break
	elif row1[i] == '0' or row2[i] == '0':
		flag = 2
		break
zeros = 0
ans = 0
for i in range(1, n):
	if flag == None:
		if row1[i] == '0' and row2[i] == '0':
			flag = 1
		elif row1[i] == '0' or row2[i] == '0':
			flag = 2
		continue
	if row1[i] == row2[i] == '0':
		if flag == 2:
			ans += 1
			zeros = 0
			flag = None
		else:
			zeros += 1
	elif flag == 1:
		if (zeros + 1) % 3 == 0:
			ans += (zeros + 1) // 3 * 2
		elif (zeros + 1) % 3 == 2:
			ans += (zeros + 1) // 3 * 2 + 1
		elif row1[i] != row2[i]:
			ans += (zeros + 1) // 3 * 2 + 1
			flag = None
			zeros = 0
			continue
		else:
			ans += (zeros + 1) // 3 * 2
			flag = 2
		if row1[i] == row2[i]:
			flag = None
		else:
			flag = 2
		zeros = 0
	elif row1[i] == row2[i]:
		flag = None
if flag == 1:
	if (zeros + 1) % 3 == 0 or (zeros + 1) % 3 == 1:
		ans += (zeros + 1) // 3 * 2
	elif (zeros + 1) % 3 == 2:
		ans += (zeros + 1) // 3 * 2 + 1
elif flag == 2 and zeros == 1:
	ans += 1
print(ans)


num = []
num.append(list((i for i in input())))
num.append(list((i for i in input())))
ans = 0
for i in range(len(num[0]) - 1):
	if num[0][i] == '0' and num[1][i] == '0':
		if num[0][i + 1] == '0':
			ans += 1
			num[0][i + 1] = 'X'
		elif num[1][i + 1] == '0':
			ans += 1
			num[1][i + 1] = 'X'
	elif num[0][i + 1] == '0' and num[1][i + 1] == '0':
		if num[0][i] == '0' or num[1][i] == '0':
			ans += 1
			num[0][i + 1] = 'X'
			num[1][i + 1] = 'X'
print(ans)


ar = []
cur = list(input())
ar.append(cur)
cur = list(input())
ar.append(cur)
count = 0
n = len(cur)
if n == 1:
	print(0)
else:
	for i in range(n):
		if ar[0][i] == 'X':
			continue
		if i == 0:
			if ar[1][i] == '0' and ar[1][i + 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[1][i] = 'X'
				ar[1][i + 1] = 'X'
				ar[0][i] = 'X'
			elif ar[0][i + 1] == '0' and ar[1][i + 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[0][i + 1] = 'X'
				ar[1][i + 1] = 'X'
				ar[0][i] = 'X'
		elif i == n - 1:
			if ar[0][i - 1] == '0' and ar[1][i - 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[0][i - 1] = 'X'
				ar[1][i - 1] = 'X'
				ar[0][i] = 'X'
			if ar[1][i] == '0' and ar[1][i - 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[1][i] = 'X'
				ar[1][i - 1] = 'X'
				ar[0][i] = 'X'
		else:
			if ar[0][i - 1] == '0' and ar[1][i - 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[0][i - 1] = 'X'
				ar[1][i - 1] = 'X'
				ar[0][i] = 'X'
			if ar[1][i] == '0' and ar[1][i - 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[1][i] = 'X'
				ar[1][i - 1] = 'X'
				ar[0][i] = 'X'
			if ar[1][i] == '0' and ar[1][i + 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[1][i] = 'X'
				ar[1][i + 1] = 'X'
				ar[0][i] = 'X'
			if ar[0][i + 1] == '0' and ar[1][i + 1] == '0' and (ar[0][i] == '0'):
				count += 1
				ar[0][i + 1] = 'X'
				ar[1][i + 1] = 'X'
				ar[0][i] = 'X'
	for i in range(n):
		if ar[1][i] == 'X':
			continue
		if i == 0:
			if ar[0][i] == '0' and ar[0][i + 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i] = 'X'
				ar[0][i + 1] = 'X'
				ar[1][i] = 'X'
			if ar[0][i + 1] == '0' and ar[1][i + 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i + 1] = 'X'
				ar[1][i + 1] = 'X'
				ar[1][i] = 'X'
		elif i == n - 1:
			if ar[0][i - 1] == '0' and ar[1][i - 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i - 1] = 'X'
				ar[1][i - 1] = 'X'
				ar[1][i] = 'X'
			if ar[0][i] == '0' and ar[0][i - 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i] = 'X'
				ar[0][i - 1] = 'X'
				ar[1][i] = 'X'
		else:
			if ar[0][i - 1] == '0' and ar[1][i - 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i - 1] = 'X'
				ar[1][i - 1] = 'X'
				ar[1][i] = 'X'
			if ar[0][i] == '0' and ar[0][i - 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i] = 'X'
				ar[0][i - 1] = 'X'
				ar[1][i] = 'X'
			if ar[0][i] == '0' and ar[0][i + 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i] = 'X'
				ar[0][i + 1] = 'X'
				ar[1][i] = 'X'
			if ar[0][i + 1] == '0' and ar[1][i + 1] == '0' and (ar[1][i] == '0'):
				count += 1
				ar[0][i + 1] = 'X'
				ar[1][i + 1] = 'X'
				ar[1][i] = 'X'
	print(count)


s1 = input()
s2 = input()
counter = 0
statemp = 0
if s1[0] == '0' and s2[0] == '0':
	statemp = 2
elif s1[0] == 'X' and s2[0] == 'X':
	statemp = 0
else:
	statemp = 1
for i in range(1, len(s1)):
	f = 0
	if s1[i] == '0' and s2[i] == '0':
		if statemp == 2:
			counter += 1
			f = 1
		elif statemp == 1:
			counter += 1
			f = 0
		else:
			f = 2
	elif s1[i] == 'X' and s2[i] == 'X':
		f = 0
	elif statemp == 2:
		counter += 1
		f = 0
	else:
		f = 1
	statemp = f
print(counter)


n = list(input())
p = list(input())
t = len(n)
count = 0
for i in range(t - 1):
	if n[i] == '0' and p[i] == '0' and (p[i + 1] == '0'):
		count = count + 1
		n[i] = 'X'
		p[i] = 'X'
		p[i + 1] = 'X'
	elif n[i] == '0' and p[i] == '0' and (n[i + 1] == '0'):
		count = count + 1
		n[i] = 'X'
		p[i] = 'X'
		n[i + 1] = 'X'
	elif n[i] == '0' and n[i + 1] == '0' and (p[i + 1] == '0'):
		count = count + 1
		n[i + 1] = 'X'
		n[i] = 'X'
		p[i + 1] = 'X'
	elif p[i] == '0' and n[i + 1] == '0' and (p[i + 1] == '0'):
		count = count + 1
		n[i + 1] = 'X'
		p[i] = 'X'
		p[i + 1] = 'X'
print(count)


a = []
a.append(['X'] + list(input()) + ['X'])
n = len(a[0])
a.append(['X'] + list(input()) + ['X'])
cnt = 0
for i in range(1, n):
	if a[0][i] == '0' and a[1][i] == '0':
		if a[0][i - 1] == '0':
			cnt += 1
			a[0][i - 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			continue
		elif a[1][i - 1] == '0':
			cnt += 1
			a[1][i - 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			continue
		elif a[0][i + 1] == '0':
			cnt += 1
			a[0][i + 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			continue
		elif a[1][i + 1] == '0':
			cnt += 1
			a[1][i + 1] = 'X'
			a[0][i] = 'X'
			a[1][i] = 'X'
			continue
print(cnt)


s = [list(input()) for i in range(2)]
n = len(s[0])
ans = 0
if n > 1:
	i = 0
	if s[0][i] == s[1][i] and s[0][i] != 'X':
		if s[0][i] == s[0][i + 1]:
			ans += 1
			s[0][i] = 'X'
			s[1][i] = 'X'
			s[0][i + 1] = 'X'
		elif s[0][i] == s[1][i + 1]:
			ans += 1
			s[0][i] = 'X'
			s[1][i] = 'X'
			s[1][i + 1] = 'X'
	for i in range(1, n - 1):
		if s[0][i] != s[1][i] or s[0][i] == 'X':
			continue
		if s[0][i] == s[0][i - 1]:
			ans += 1
			s[0][i] = 'X'
			s[1][i] = 'X'
			s[0][i - 1] = 'X'
		elif s[0][i] == s[1][i - 1]:
			ans += 1
			s[0][i] = 'X'
			s[1][i] = 'X'
			s[1][i - 1] = 'X'
		elif s[0][i] == s[0][i + 1]:
			ans += 1
			s[0][i] = 'X'
			s[1][i] = 'X'
			s[0][i + 1] = 'X'
		elif s[0][i] == s[1][i + 1]:
			ans += 1
			s[0][i] = 'X'
			s[1][i] = 'X'
			s[1][i + 1] = 'X'
	i = n - 1
	if s[0][i] == s[1][i] and s[0][i] != 'X':
		if s[0][i] == s[0][i - 1]:
			ans += 1
		elif s[0][i] == s[1][i - 1]:
			ans += 1
print(ans)


f = []
for i in range(2):
	f.append(list(input()))
answer = 0
n = len(f[0])
for i in range(n):
	if f[0][i] == f[1][i] == '0' and i + 1 < n:
		if f[0][i + 1] == '0':
			answer += 1
			f[0][i + 1] = 'X'
		elif f[1][i + 1] == '0':
			answer += 1
			f[1][i + 1] = 'X'
	elif (f[1][i] == '0' or f[0][i] == '0') and i + 1 < n and (f[0][i + 1] == f[1][i + 1] == '0'):
		answer += 1
		f[0][i + 1] = f[1][i + 1] = 'X'
print(answer)


a = []
for i in range(2):
	a.append(input())
(ans, cnt, cur) = (0, 0, 0)
n = len(a[0])
for i in range(n):
	cnt = (a[0][i] == '0') + (a[1][i] == '0')
	cur += cnt
	if cur >= 3:
		cur -= 3
		ans += 1
	else:
		cur = cnt
print(ans)


str1 = input()
str2 = input()
count = 0
for i in range(len(str1) - 1):
	if str1[i] == '0' and str1[i + 1] == '0' and (str2[i] == '0'):
		count = count + 1
		str1 = str1[:i] + 'X' + str1[i + 1:]
		str1 = str1[:i + 1] + 'X' + str1[i + 2:]
		str2 = str2[:i] + 'X' + str2[i + 1:]
	elif str1[i] == '0' and str1[i + 1] == '0' and (str2[i + 1] == '0'):
		count = count + 1
		str1 = str1[:i] + 'X' + str1[i + 1:]
		str1 = str1[:i + 1] + 'X' + str1[i + 2:]
		str2 = str2[:i + 1] + 'X' + str2[i + 2:]
	elif str1[i + 1] == '0' and str2[i] == '0' and (str2[i + 1] == '0'):
		count = count + 1
		str1 = str1[:i + 1] + 'X' + str1[i + 2:]
		str2 = str2[:i] + 'X' + str2[i + 1:]
		str2 = str2[:i + 1] + 'X' + str2[i + 2:]
	elif str1[i] == '0' and str2[i] == '0' and (str2[i + 1] == '0'):
		count = count + 1
		str1 = str1[:i] + 'X' + str1[i + 1:]
		str2 = str2[:i] + 'X' + str2[i + 1:]
		str2 = str2[:i + 1] + 'X' + str2[i + 2:]
print(count)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
ss = [input().strip(), input().strip()]
s = [a + b for (a, b) in zip(ss[0], ss[1])] + ['XX']
n = len(s)

def solve(i, j):
	c = 0
	k = i
	while k < j - 1:
		if s[k] == '0X' and s[k + 1] == '00':
			c += 1
			k += 2
		elif s[k] == 'X0' and s[k + 1] == '00':
			c += 1
			k += 2
		elif s[k] == '00' and s[k + 1] == 'X0':
			c += 1
			k += 2
		elif s[k] == '00' and s[k + 1] == '0X':
			c += 1
			k += 2
		elif s[k] == '00' and s[k + 1] == '00':
			c += 1
			s[k + 1] = '0X'
			k += 1
		else:
			k += 1
	return c
i = 0
c = 0
while i < n:
	if s[i] == 'XX':
		i += 1
		continue
	j = i + 1
	while s[j] != 'XX':
		j += 1
	c += solve(i, j)
	i = j
print(c)


from math import sqrt, ceil

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
s1 = si()
s2 = si()
n = len(s1)
c = 0
s1 = list(s1)
s2 = list(s2)
for i in range(n):
	f = 0
	if s1[i] == '0' and s2[i] == '0':
		if i >= 1 and s1[i - 1] == '0':
			f = 1
			s1[i - 1] = 'X'
		elif i >= 1 and s2[i - 1] == '0':
			f = 1
			s2[i - 1] = 'X'
		elif i < n - 1 and s2[i + 1] == '0':
			f = 1
			s2[i + 1] = 'X'
		elif i < n - 1 and s1[i + 1] == '0':
			f = 1
			s1[i + 1] = 'X'
		s1[i] = 'X'
		s2[i] = 'X'
		if f == 1:
			c += 1
print(c)


a = input()
b = input()
n = len(a)
(cana, canb) = ([True] * n, [True] * n)
ans = 0
for i in range(n - 1):
	if a[i] == b[i] == a[i + 1] == '0' and cana[i] & cana[i + 1] & canb[i] == True:
		ans += 1
		cana[i] = cana[i + 1] = canb[i] = False
	elif a[i] == b[i] == b[i + 1] == '0' and cana[i] & canb[i + 1] & canb[i] == True:
		ans += 1
		cana[i] = canb[i + 1] = canb[i] = False
	elif a[i + 1] == b[i] == b[i + 1] == '0' and cana[i + 1] & canb[i + 1] & canb[i] == True:
		ans += 1
		cana[i + 1] = canb[i + 1] = canb[i] = False
	elif a[i + 1] == a[i] == b[i + 1] == '0' and cana[i] & canb[i + 1] & cana[i + 1] == True:
		ans += 1
		cana[i] = canb[i + 1] = cana[i + 1] = False
print(ans)


line1 = input()
line2 = input()
boards = [['' for x in range(len(line1))] for y in range(2)]
for i in range(len(line1)):
	boards[0][i] = line1[i]
	boards[1][i] = line2[i]
count = 0
for x in range(len(line1) - 1):
	if 3 <= boards[0][x:x + 2].count('0') + boards[1][x:x + 2].count('0'):
		count += 1
		if boards[0][x] == '0':
			if boards[0][x + 1] == '0':
				boards[0][x] = 'X'
				boards[0][x + 1] = 'X'
				if boards[1][x] == '0':
					boards[1][x] = 'X'
				else:
					boards[1][x + 1] = 'X'
			else:
				boards[0][x] = 'X'
				boards[1][x] = 'X'
				boards[1][x + 1] = 'X'
		else:
			boards[0][x + 1] = 'X'
			boards[1][x] = 'X'
			boards[1][x + 1] = 'X'
print(count)


s = list(input())
st = list(input())
c = 0
for i in range(len(s)):
	if i > 0:
		if s[i - 1] == st[i - 1] == '0':
			if s[i] == '0':
				s[i - 1] = 'Y'
				st[i - 1] = 'Y'
				s[i] = 'Y'
				c += 1
			elif st[i] == '0':
				s[i - 1] = 'Y'
				st[i - 1] = 'Y'
				st[i] = 'Y'
				c += 1
		if s[i] == st[i] == '0':
			if s[i - 1] == '0':
				s[i] = 'Y'
				st[i] = 'Y'
				s[i - 1] = 'Y'
				c += 1
			elif st[i - 1] == '0':
				s[i] = 'Y'
				st[i] = 'Y'
				st[i - 1] = 'Y'
				c += 1
		elif s[i] == '0':
			if s[i - 1] == st[i - 1] == '0':
				s[i - 1] = 'Y'
				st[i - 1] = 'Y'
				s[i] = 'Y'
				c += 1
		elif st[i] == '0':
			if s[i - 1] == st[i - 1] == '0':
				s[i - 1] = 'Y'
				st[i - 1] = 'Y'
				st[i] = 'Y'
				c += 1
print(c)


a1 = list(input())
a2 = list(input())
c = 0
for i in range(len(a1) - 1):
	if a1[i] == '0' and a2[i] == '0' and (a1[i + 1] == '0'):
		c += 1
		a1[i] = 1
		a2[i] = 1
		a1[i + 1] = 1
	elif a1[i] == '0' and a2[i] == '0' and (a2[i + 1] == '0'):
		c += 1
		a1[i] = 1
		a2[i] = 1
		a2[i + 1] = 1
	elif a1[i + 1] == '0' and a2[i] == '0' and (a2[i + 1] == '0'):
		c += 1
		a2[i] = 1
		a1[i + 1] = 1
		a2[i + 1] = 1
	elif a1[i] == '0' and a2[i + 1] == '0' and (a1[i + 1] == '0'):
		c += 1
		a1[i] = 1
		a1[i + 1] = 1
		a2[i + 1] = 1
print(c)


fig1 = ((1, 1), (0, 1))
fig2 = ((1, 1), (1, 0))
fig3 = ((0, 1), (1, 1))
fig4 = ((1, 0), (1, 1))

def place(fig, grid):
	if len(grid[0]) < 2:
		return (False, grid)
	copygrid = [grid[0][:], grid[1][:]]
	for r in range(2):
		for c in range(2):
			copygrid[r][c] += fig[r][c]
			if copygrid[r][c] > 1:
				return (False, grid)
	return (True, copygrid)

def shiftgrid(grid):
	return [grid[0][1:], grid[1][1:]]

def cachekey(grid):
	return (tuple(grid[0]), tuple(grid[1]))
cache = {}

def place_no(grid):
	if len(grid[0]) < 2:
		return 0
	key = cachekey(grid)
	if key in cache:
		return cache[key]
	options = []
	for fig in (fig1, fig2, fig3, fig4):
		(placed, newgrid) = place(fig, grid)
		options.append(int(placed) + place_no(shiftgrid(newgrid)))
	options.append(place_no(shiftgrid(grid)))
	rv = max(options)
	cache[key] = rv
	return rv

def main():
	grid = []
	grid.append([0 if c == '0' else 1 for c in input().strip()])
	grid.append([0 if c == '0' else 1 for c in input().strip()])
	print(place_no(grid))
main()


t = input()
b = input()
n = len(t)
ta = [c == '0' for c in t]
ba = [c == '0' for c in b]
cnt = 0
for i in range(n - 1):
	if ta[i] and ta[i + 1] and ba[i]:
		cnt += 1
		ta[i] = ta[i + 1] = ba[i] = False
	if ta[i] and ba[i + 1] and ba[i]:
		cnt += 1
		ta[i] = ba[i + 1] = ba[i] = False
	if ta[i] and ta[i + 1] and ba[i + 1]:
		cnt += 1
		ta[i] = ta[i + 1] = ba[i + 1] = False
	if ta[i + 1] and ba[i] and ba[i + 1]:
		cnt += 1
		ta[i + 1] = ba[i] = ba[i + 1] = False
print(cnt)


m = list(input())
n = list(input())
cnt = 0
for i in range(len(m) - 1):
	if '000' == m[i] + n[i] + n[i + 1]:
		m[i] = n[i] = n[i + 1] = 'x'
		cnt = cnt + 1
	elif '000' == m[i] + m[i + 1] + n[i + 1]:
		m[i] = m[i + 1] = n[i + 1] = 'x'
		cnt = cnt + 1
	elif '000' == m[i] + m[i + 1] + n[i]:
		m[i] = m[i + 1] = n[i] = 'x'
		cnt = cnt + 1
	elif '000' == m[i + 1] + n[i + 1] + n[i]:
		m[i + 1] = n[i + 1] = n[i] = 'x'
		cnt = cnt + 1
print(cnt)


s = list(input())
s1 = list(input())
m = [s, s1]
ans = c = 0
n = len(s)
for i in range(0, n - 1):
	a = ''
	a += m[0][i]
	a += m[0][i + 1]
	a += m[1][i]
	a += m[1][i + 1]
	j = a.count('0')
	if j == 3:
		c += 1
		m[0][i] = '-1'
		m[0][i + 1] = '-1'
		m[1][i] = '-1'
		m[1][i + 1] = '-1'
	if j == 4:
		c += 1
		m[0][i] = '-1'
		m[1][i] = '-1'
		m[1][i + 1] = '-1'
print(c)


3

def o(c):
	return c == '0'

def solve(A, B, N):
	A += 'XXX'
	B += 'XXX'
	i = 0
	c = 0
	while i < N:
		if o(A[i]) and o(A[i + 1]) and o(A[i + 2]) and o(B[i]) and o(B[i + 1]) and o(B[i + 2]):
			c += 2
			i += 3
			continue
		x = len([x for x in [o(A[i]), o(A[i + 1]), o(B[i]), o(B[i + 1])] if x])
		if x >= 3:
			c += 1
			i += 2
			continue
		i += 1
	return c

def main():
	A = input()
	B = input()
	N = len(A)
	assert len(B) == N
	print(solve(A, B, N))

def __starting_point():
	main()
__starting_point()


coor___top = input()
coor___bot = input()
coor_len = len(coor___bot)
curr_coor___s_nr = {coor___top[0] + coor___bot[0]: 0}
next_coor___s_nr = {'XX': -1, 'X0': -1, '0X': -1, '00': -1}
for coor in range(1, coor_len):
	next_sym = coor___top[coor] + coor___bot[coor]
	for curr_sym in curr_coor___s_nr:
		curr_s_nr = curr_coor___s_nr[curr_sym]
		next_coor___s_nr[next_sym] = max(next_coor___s_nr[next_sym], curr_s_nr)
		if next_sym in ['X0', '0X'] and curr_sym == '00':
			next_coor___s_nr['XX'] = max(next_coor___s_nr['XX'], curr_s_nr + 1)
		if next_sym == '00' and curr_sym in ['X0', '0X']:
			next_coor___s_nr['XX'] = max(next_coor___s_nr['XX'], curr_s_nr + 1)
		if curr_sym == '00' and next_sym == '00':
			next_coor___s_nr['X0'] = max(next_coor___s_nr['X0'], curr_s_nr + 1)
			next_coor___s_nr['0X'] = max(next_coor___s_nr['0X'], curr_s_nr + 1)
	curr_coor___s_nr = next_coor___s_nr
	next_coor___s_nr = {'XX': -1, 'X0': -1, '0X': -1, '00': -1}
print(max(curr_coor___s_nr.values()))


first = input()
second = input()
adad = list()
for i in range(len(first)):
	num = 0
	if first[i] == '0':
		num += 1
	if second[i] == '0':
		num += 1
	adad.append(num)
cnt = 0
last_fill = -1
for i in range(1, len(adad)):
	if adad[i] + adad[i - 1] == 3:
		cnt += 1
		adad[i] = adad[i - 1] = 0
	elif adad[i] + adad[i - 1] == 4:
		cnt += 1
		adad[i] = 1
		adad[i - 1] = 0
print(cnt)


import time
s1 = input()
s2 = input()
start = time.time()
n = len(s1)
ans = 0
flag = 0
for i in range(n):
	if s1[i] != '0' and s2[i] != '0':
		flag = 0
		continue
	if flag == 0:
		if s1[i] == '0' and s2[i] == '0':
			flag = 2
		elif s1[i] == '0' or s2[i] == '0':
			flag = 1
	elif flag == 1:
		if s1[i] == '0' and s2[i] == '0':
			ans += 1
			flag = 0
	else:
		ans += 1
		if s1[i] == '0' and s2[i] == '0':
			flag = 1
		else:
			flag = 0
print(ans)
finish = time.time()


a = list(input())
b = list(input())
r = 0
for i in range(len(a) - 1):
	if a[i] == '0' and b[i] == '0':
		if a[i + 1] == '0':
			a[i + 1] = 'X'
			r += 1
		elif b[i + 1] == '0':
			b[i + 1] = 'X'
			r += 1
	elif a[i] == '0' or b[i] == '0':
		if a[i + 1] == '0' and b[i + 1] == '0':
			a[i + 1] = 'X'
			b[i + 1] = 'X'
			r += 1
print(r)


field = [list(input()) for _ in range(2)]
ans = 0
for i in range(len(field[0]) - 1):
	if field[0][i] == '0' and field[1][i] == '0':
		if field[0][i + 1] == '0':
			ans += 1
			field[0][i] = '.'
			field[1][i] = '.'
			field[0][i + 1] = '.'
		elif field[1][i + 1] == '0':
			ans += 1
			field[0][i] = '.'
			field[1][i] = '.'
			field[1][i + 1] = '.'
	elif field[0][i] == '0':
		if field[0][i + 1] == '0' and field[1][i + 1] == '0':
			ans += 1
			field[0][i] = '.'
			field[0][i + 1] = '.'
			field[1][i + 1] = '.'
	elif field[1][i] == '0':
		if field[0][i + 1] == '0' and field[1][i + 1] == '0':
			ans += 1
			field[1][i] = '.'
			field[0][i + 1] = '.'
			field[1][i + 1] = '.'
print(ans)


a = input()
b = input()
n = len(a)
ans = 0
l = 2
i = 0
if a[0] == 'X':
	l -= 1
if b[0] == 'X':
	l -= 1
while i < n - 1:
	count = 0
	if a[i + 1] == '0':
		count += 1
	if b[i + 1] == '0':
		count += 1
	if l + count >= 3:
		ans += 1
		if l + count == 3:
			l = 0
		else:
			l = 1
	else:
		l = count
	i += 1
print(ans)


s1 = input()
s2 = input()
L1 = [c == '0' for c in s1]
L2 = [c == '0' for c in s2]
ans = 0
for i in range(len(s1) - 1):
	if L1[i] and L2[i]:
		if L1[i + 1]:
			L1[i] = L2[i] = L1[i + 1] = False
			ans += 1
		elif L2[i + 1]:
			L1[i] = L2[i] = L2[i + 1] = False
			ans += 1
	elif L1[i + 1] and L2[i + 1]:
		if L1[i]:
			L1[i] = L1[i + 1] = L2[i + 1] = False
			ans += 1
		elif L2[i]:
			L2[i] = L1[i + 1] = L2[i + 1] = False
			ans += 1
print(ans)


s = input()
s1 = input()
l = [[], []]
for i in range(len(s)):
	l[0].append(s[i])
	l[1].append(s1[i])
k = 0
for i in range(len(s) - 1):
	if l[0][i] == l[1][i] == l[0][i + 1] == '0':
		k += 1
		l[0][i + 1] = 'X'
		continue
	if l[0][i] == l[1][i] == l[1][i + 1] == '0':
		k += 1
		l[1][i + 1] = 'X'
		continue
	if l[0][i] == l[1][i + 1] == l[0][i + 1] == '0' or l[1][i] == l[1][i + 1] == l[0][i + 1] == '0':
		k += 1
		l[1][i + 1] = 'X'
		l[0][i + 1] = 'X'
print(k)


s1 = input()
s2 = input()
dp = [0 for i in range(len(s1))]
if s1[0] == s2[0] and s1[0] == '0':
	r = 2
elif s1[0] == s2[0] and s1[0] == 'X':
	r = 0
else:
	r = 1
for i in range(1, len(s1)):
	if s1[i] == s2[i] and s1[i] == 'X':
		dp[i] = dp[i - 1]
		r = 0
	elif s1[i] != s2[i] and r <= 1:
		dp[i] = dp[i - 1]
		r = 1
	elif s1[i] == s2[i] and s1[i] == '0':
		if r == 2:
			dp[i] = dp[i - 1] + 1
			r = 1
		elif r == 1:
			dp[i] = dp[i - 1] + 1
			r = 0
		else:
			dp[i] = dp[i - 1]
			r = 2
	else:
		dp[i] = dp[i - 1] + 1
		r = 0
print(dp[len(s1) - 1])


a1 = input()
a2 = input()
x = [[0, 0, 0, 0] for _ in range(len(a1))]
for i in range(1, len(a1)):
	x[i][3] = max(x[i - 1])
	if a1[i - 1] == a2[i - 1] == '0':
		if a1[i] == '0':
			x[i][0] = x[i - 1][3] + 1
		if a2[i] == '0':
			x[i][1] = x[i - 1][3] + 1
	if a1[i] == a2[i] == '0':
		if a1[i - 1] == '0':
			x[i][2] = max(x[i - 1][1] + 1, x[i][2])
			x[i][2] = max(x[i][2], x[i - 1][3] + 1)
		if a2[i - 1] == '0':
			x[i][2] = max(x[i - 1][0] + 1, x[i][2])
			x[i][2] = max(x[i][2], x[i - 1][3] + 1)
print(max(x[-1]))


s = []
m = 0
n = 2
for i in range(0, n):
	s.append(input())
	m = len(s[i])
n = m
ans = 0
empty = 0
for i in range(0, n):
	current = int((s[0][i] == '0') + (s[1][i] == '0'))
	empty += current
	if empty >= 3:
		empty -= 3
		ans += 1
	else:
		empty = current
print(ans)


s = [list(input()), list(input())]
ans = 0
l = len(s[0])
i = 0
while i < l - 1:
	a = (s[0][i], s[0][i + 1], s[1][i], s[1][i + 1])
	if a.count('0') == 4:
		ans += 1
		s[0][i + 1] = 'X'
		i += 1
	elif a.count('0') == 3:
		ans += 1
		i += 2
	else:
		i += 1
print(ans)


board = []
for i in range(2):
	board.append([i == '0' for i in input()])
before_up = False
before_down = False
s = 0
for i in range(len(board[0])):
	if before_up and before_down:
		if board[0][i]:
			s += 1
			before_up = False
			before_down = board[1][i]
		elif board[1][i]:
			s += 1
			before_down = False
			before_up = board[0][i]
		else:
			before_up = False
			before_down = False
	elif before_up or before_down:
		if board[0][i] and board[1][i]:
			s += 1
			before_up = False
			before_down = False
		else:
			before_up = board[0][i]
			before_down = board[1][i]
	else:
		before_up = board[0][i]
		before_down = board[1][i]
print(s)


s1 = input().strip()
s2 = input().strip()
n = len(s1)
c = 0
i = 0
while i < n - 1:
	a = s1[i:i + 2]
	b = s2[i:i + 2]
	if a == '00' and b == '0X':
		c += 1
		i += 2
	elif a == 'X0' and b == '00':
		c += 1
		i += 2
	elif a == '0X' and b == '00':
		c += 1
		i += 2
	elif a == '00' and b == 'X0':
		c += 1
		i += 2
	elif a == '00' and b == '00':
		c += 1
		if i < n - 2 and s1[i + 2] == '0' and (s2[i + 2] == '0'):
			i += 1
			c += 1
		i += 2
	else:
		i += 1
print(c)


data = [list(input().strip()), list(input().strip())]
n = len(data[0])
inf = 10 ** 9
ans = 0
for i in range(n - 1):
	a = data[0][i] + data[1][i] + data[0][i + 1] + data[1][i + 1]
	if a.count('0') >= 3:
		ans += 1
		if data[0][i] == '0':
			data[0][i] = 'X'
		if data[1][i] == '0':
			data[1][i] = 'X'
		if data[0][i + 1] == '0':
			data[0][i + 1] = 'X'
		if data[1][i + 1] == '0' and a != '0000':
			data[1][i + 1] = 'X'
print(ans)


l = list(input())
m = list(input())
count = 0
n = len(l)
for i in range(len(l)):
	if l[i] == '0':
		if i + 1 < n and m[i] == '0' and (m[i + 1] == '0'):
			count += 1
			l[i] = 'X'
			m[i] = 'X'
			m[i + 1] = 'X'
		elif i - 1 >= 0 and m[i] == '0' and (m[i - 1] == '0'):
			count += 1
			l[i] = 'X'
			m[i] = 'X'
			m[i - 1] = 'X'
		elif i + 1 < n and l[i + 1] == '0' and (m[i + 1] == '0'):
			l[i] = 'X'
			l[i + 1] = 'X'
			m[i + 1] = 'X'
			count += 1
		elif i - 1 >= 0 and l[i - 1] == '0' and (m[i - 1] == '0'):
			l[i] = 'X'
			l[i - 1] = 'X'
			m[i - 1] = 'X'
			count += 1
	if m[i] == '0':
		if i + 1 < n and l[i] == '0' and (l[i + 1] == '0'):
			count += 1
			m[i] = 'X'
			l[i] = 'X'
			l[i + 1] = 'X'
		elif i - 1 >= 0 and l[i] == '0' and (l[i - 1] == '0'):
			count += 1
			m[i] = 'X'
			l[i] = 'X'
			l[i - 1] = 'X'
		elif i + 1 < n and m[i + 1] == '0' and (l[i + 1] == '0'):
			m[i] = 'X'
			m[i + 1] = 'X'
			l[i + 1] = 'X'
			count += 1
		elif i - 1 >= 0 and m[i - 1] == '0' and (l[i - 1] == '0'):
			m[i] = 'X'
			m[i - 1] = 'X'
			l[i - 1] = 'X'
			count += 1
print(count)


def main():
	(a, b) = ([i for i in input()], [i for i in input()])
	l = len(a)
	c = 0
	for i in range(l - 1):
		if a[i] == '0':
			if b[i] == '0':
				if a[i + 1] == '0':
					c += 1
					(a[i], b[i], a[i + 1]) = (1, 1, 1)
				elif b[i + 1] == '0':
					c += 1
					(a[i], b[i], b[i + 1]) = (1, 1, 1)
			elif a[i + 1] == '0' and b[i + 1] == '0':
				c += 1
				(a[i], a[i + 1], b[i + 1]) = (1, 1, 1)
		elif b[i] == '0' and b[i + 1] == '0' and (a[i + 1] == '0'):
			c += 1
			(b[i], a[i + 1], b[i + 1]) = (1, 1, 1)
	print(c)
	return 0
main()


import os
import sys
from io import BytesIO, IOBase

def get(a, x):
	return (a[0][x] == '0') + (a[1][x] == '0')

def main():
	a = [input().rstrip() for _ in range(2)]
	n = len(a[0])
	if n == 1:
		print(0)
	else:
		dp = [[-1, -1, -1] for _ in range(n)]
		z = get(a, 0)
		dp[0][z] = 0
		for i in range(1, n):
			z = get(a, i)
			if z == 0:
				dp[i][0] = max(dp[i - 1])
			elif z == 1:
				dp[i][0] = dp[i - 1][2] + 1
				dp[i][1] = max(dp[i - 1])
			elif z == 2:
				dp[i][0] = max(dp[i - 1][1] + 1, dp[i - 1][2] + (i != 1))
				dp[i][1] = dp[i - 1][2] + 1
				dp[i][2] = max(dp[i - 1])
		print(max(dp[-1]))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(s1, s2) = (input(), input())
s1 += 'X' * max(0, 3 - len(s1))
s2 += 'X' * max(0, 3 - len(s2))
(l, count) = (len(s1), 0)
(s1, s2) = (list(s1), list(s2))
for i in range(l - 1):
	(a, b, c, d) = (s1[i], s1[i + 1], s2[i], s2[i + 1])
	ss = sum((1 for x in [a, b, c, d] if x == 'X'))
	if ss > 1:
		continue
	elif ss == 1:
		count += 1
		(s1[i], s1[i + 1], s2[i], s2[i + 1]) = ['X'] * 4
	else:
		count += 1
		(s1[i], s1[i + 1], s2[i]) = ['X'] * 3
print(count)


str1 = input()
str2 = input()
l = len(str1)
num = []
for i in range(0, l):
	num.append(0)
	if str1[i] == '0':
		num[i] = num[i] + 1
	if str2[i] == '0':
		num[i] = num[i] + 1
now = 0
res = 0
for i in num:
	now = now + i
	if now >= 3:
		res = res + 1
		now = now - 3
	elif now <= 2 and i != 2:
		now = i
print(res)


s = ['', '']
s[0] = input()
s[1] = input()
pcs = 0
emp = 0
half = False
n = len(s[1])
for i in range(n):
	if s[0][i] == '0' and s[1][i] == '0':
		emp += 1
		if emp == 3:
			emp = 0
			pcs += 2
		if emp == 1 and half:
			pcs += 1
			emp = 0
		half = False
	elif s[0][i] == 'X' and s[1][i] == 'X':
		if emp == 2:
			pcs += 1
		emp = 0
		half = False
	else:
		half = True
		if emp == 2:
			pcs += 1
		elif emp == 1:
			half = False
			pcs += 1
		emp = 0
if emp == 3:
	pcs += 2
elif emp == 2:
	pcs += 1
elif emp == 1 and half:
	pcs += 1
print(pcs)


l1 = list(input())
l2 = list(input())
count = 0
for i in range(1, len(l1)):
	if l1[i - 1] == '0' and l2[i - 1] == '0' and (l1[i] == '0'):
		count += 1
		l1[i - 1] = l1[i] = l2[i - 1] = 'X'
	if l1[i] == '0' and l1[i - 1] == '0' and (l2[i] == '0'):
		count += 1
		l1[i] = l1[i - 1] = l2[i] = 'X'
	if l2[i] == '0' and l2[i - 1] == '0' and (l1[i] == '0'):
		count += 1
		l2[i] = l1[i] = l2[i - 1] = 'X'
	if l2[i - 1] == '0' and l1[i - 1] == '0' and (l2[i] == '0'):
		count += 1
		l2[i] = l2[i - 1] = l1[i - 1] = 'X'
print(count)


def read_input():
	return map(int, input().split())
a = [list(input()), list(input())]
ans = 0
n = len(a[0])
i = 0
while i + 1 < n:
	cnt = sum((c == 'X' for c in [a[0][i], a[1][i], a[0][i + 1], a[1][i + 1]]))
	if cnt > 1:
		i += 1
		continue
	if cnt == 1:
		ans += 1
		i += 2
		continue
	ans += 1
	a[0][i + 1] = 'X'
	i += 1
print(ans)


A = []
A += [input()]
A += [input()]
n = len(A[0])
B = [[0 for _ in range(4)] for _ in range(n + 1)]
B[0][0] = -1000
B[0][1] = -1000
B[0][2] = -1000
B[0][3] = 0
for i in range(1, n + 1):
	if A[1][i - 1] == 'X':
		B[i][0] = -1000
	elif A[0][i - 1] == 'X':
		B[i][0] = max([B[i - 1][j] for j in range(4)])
	else:
		B[i][0] = max([B[i - 1][2] + 1] + [B[i - 1][0], B[i - 1][1], B[i - 1][3]])
	if A[0][i - 1] == 'X':
		B[i][1] = -1000
	elif A[1][i - 1] == 'X':
		B[i][1] = max([B[i - 1][j] for j in range(4)])
	else:
		B[i][1] = max([B[i - 1][2] + 1] + [B[i - 1][0], B[i - 1][1], B[i - 1][3]])
	if A[0][i - 1] == 'X' or A[1][i - 1] == 'X':
		B[i][2] = -1000
	else:
		B[i][2] = max([B[i - 1][j] for j in range(4)])
	if A[0][i - 1] == 'X' and A[1][i - 1] == 'X':
		B[i][3] = max([B[i - 1][j] for j in range(4)])
	elif A[0][i - 1] == 'X':
		B[i][3] = B[i - 1][2] + 1
	elif A[1][i - 1] == 'X':
		B[i][3] = B[i - 1][2] + 1
	else:
		B[i][3] = max([B[i - 1][j] for j in range(3)]) + 1
print(max([B[n][j] for j in range(4)]))


first = list(input())
second = list(input())
n = len(first)
ans = 0
for i in range(n - 1):
	if first[i] == '0' and first[i + 1] == '0' and (second[i] == '0'):
		first[i] = 'X'
		first[i + 1] = 'X'
		second[i] = 'X'
		ans = ans + 1
	elif first[i] == '0' and first[i + 1] == '0' and (second[i + 1] == '0'):
		first[i] = 'X'
		first[i + 1] = 'X'
		second[i + 1] = 'X'
		ans = ans + 1
	elif first[i] == '0' and second[i] == '0' and (second[i + 1] == '0'):
		first[i] = 'X'
		second[i] = 'X'
		second[i + 1] = 'X'
		ans = ans + 1
	elif first[i] == '0' and second[i] == '0' and (second[i + 1] == '0'):
		first[i] = 'X'
		second[i] = 'X'
		second[i + 1] = 'X'
		ans = ans + 1
	elif first[i + 1] == '0' and second[i] == '0' and (second[i + 1] == '0'):
		first[i + 1] = 'X'
		second[i] = 'X'
		second[i + 1] = 'X'
		ans = ans + 1
print(ans)


inp1 = input()
inp2 = input()
free_cells = [x.count('0') for x in zip(inp1, inp2)]
count = 0
empty = 0
for cell in free_cells:
	empty += cell
	if empty >= 3:
		empty -= 3
		count += 1
	else:
		empty = cell
print(count)


(a, b) = (list(input()), list(input()))
n = len(a)
for i in range(n):
	if a[i] == '0':
		a[i] = 0
	else:
		a[i] = 1
	if b[i] == '0':
		b[i] = 0
	else:
		b[i] = 1
s = [a, b]
(ans, prev) = (0, 0)
for i in range(n - 1):
	tmp = s[0][i] + s[0][i + 1] + s[1][i] + s[1][i + 1] + prev
	if tmp == 1:
		ans += 1
		(s[0][i], s[1][i], s[0][i + 1], s[1][i + 1]) = (1,) * 4
		prev = 0
	elif tmp == 0:
		ans += 1
		(s[0][i], s[1][i]) = (1, 1)
		prev = 1
	else:
		prev = 0
print(ans)


def solve(arr):
	placed = 0
	for i in range(len(arr[0]) - 1):
		if arr[1][i] == '0' and arr[0][i] == '0' and (arr[1][i + 1] == '0'):
			arr[1][i] = 'X'
			arr[0][i] = 'X'
			arr[1][i + 1] = 'X'
			placed += 1
		elif arr[1][i] == '0' and arr[0][i] == '0' and (arr[0][i + 1] == '0'):
			arr[1][i] = 'X'
			arr[0][i] = 'X'
			arr[0][i + 1] = 'X'
			placed += 1
		elif arr[0][i] == '0' and arr[0][i + 1] == '0' and (arr[1][i + 1] == '0'):
			arr[0][i] = 'X'
			arr[0][i + 1] = 'X'
			arr[1][i + 1] = 'X'
			placed += 1
		elif arr[1][i] == '0' and arr[0][i + 1] == '0' and (arr[1][i + 1] == '0'):
			arr[1][i] = 'X'
			arr[0][i + 1] = 'X'
			arr[1][i + 1] = 'X'
			placed += 1
	return placed
s1 = input().strip()
s2 = input().strip()
print(solve([[i for i in s1], [i for i in s2]]))


s = [None, None]
s1 = input()
s2 = input()
s[0] = s1
s[1] = s2
ans = 0
for i in range(len(s1)):
	if s[0][i] == '0' and s[1][i] == '0':
		if i + 1 != len(s1):
			if s[0][i + 1] == '0':
				s[0] = s[0][0:i] + '//' + s[0][i + 2:]
				s[1] = s[1][0:i] + '/' + s[1][i + 1:]
				ans += 1
			elif s[1][i + 1] == '0':
				s[1] = s[1][0:i] + '//' + s[1][i + 2:]
				s[0] = s[0][0:i] + '/' + s[0][i + 1:]
				ans += 1
	elif s[0][i] == '0':
		if i + 1 != len(s1):
			if s[0][i + 1] == '0' and s[1][i + 1] == '0':
				s[0] = s[0][0:i] + '//' + s[0][i + 2:]
				s[1] = s[1][0:i + 1] + '/' + s[1][i + 2:]
				ans += 1
	elif s[1][i] == '0':
		if i + 1 != len(s1):
			if s[0][i + 1] == '0' and s[1][i + 1] == '0':
				s[1] = s[1][0:i] + '//' + s[1][i + 2:]
				s[0] = s[0][0:i + 1] + '/' + s[0][i + 2:]
				ans += 1
print(ans)


import sys
(mod, MOD) = (1000000007, 998244353)
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
string1 = input()
string2 = input()
n = len(string1)
prev = 0
ans = 0
for i in range(n):
	curr = (string1[i] == '0') + (string2[i] == '0')
	if prev == 0:
		prev = curr
	elif prev == 1:
		if curr == 2:
			ans += 1
			prev = 0
		else:
			prev = curr
	elif prev == 2:
		if curr == 0:
			prev = curr
		elif curr == 1:
			ans += 1
			prev = 0
		elif curr == 2:
			ans += 1
			prev = 1
print(ans)