#include <bits/stdc++.h>
using namespace std;
string s1, s2;
long long n;
long long memo[112][2][2];
long long pd(long long i, char u, char l) {
  if (i == n - 1) return 0;
  long long &resp = memo[i][u == '0'][l == '0'];
  if (resp == -1) {
    resp = pd(i + 1, s1[i + 1], s2[i + 1]);
    if (u == '0' && l == '0' && s1[i + 1] == '0')
      resp = max(resp, 1 + pd(i + 1, 'X', s2[i + 1]));
    if (u == '0' && l == '0' && s2[i + 1] == '0')
      resp = max(resp, 1 + pd(i + 1, s1[i + 1], 'X'));
    if (s1[i + 1] == '0' && s2[i + 1] == '0' && u == '0')
      resp = max(resp, 1 + pd(i + 1, 'X', 'X'));
    if (s1[i + 1] == '0' && s2[i + 1] == '0' && l == '0')
      resp = max(resp, 1 + pd(i + 1, 'X', 'X'));
  }
  return resp;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(11);
  cout.setf(ios::fixed);
  cin >> s1 >> s2;
  n = s1.size();
  for (long long i = 0; i < n; i++) {
    memo[i][0][0] = -1;
    memo[i][0][1] = -1;
    memo[i][1][0] = -1;
    memo[i][1][1] = -1;
  }
  cout << pd(0, s1[0], s2[0]) << endl;
  return 0;
}
