#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
template <class T>
inline T mod(T x) {
  if (x < 0)
    return -x;
  else
    return x;
}
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main(int argc, char* argv[]) {
  if (argc == 2 or argc == 3) freopen(argv[1], "r", stdin);
  if (argc == 3) freopen(argv[2], "w", stdout);
  ios::sync_with_stdio(false);
  string s[2];
  int ans = 0;
  cin >> s[0] >> s[1];
  for (int i = 0; i < s[0].length(); i++) {
    bool flag = false;
    if (i > 0) {
      if (s[0][i] == '0' and s[1][i] == '0') {
        if (s[0][i - 1] == '0') {
          flag = true;
          s[0][i - 1] = 'X';
        } else if (s[1][i - 1] == '0') {
          flag = true;
          s[1][i - 1] = 'X';
        }
        if (flag) s[0][i] = 'X', s[1][i] = 'X';
      }
    }
    if (i < s[0].length() - 1) {
      if (s[0][i] == '0' and s[1][i] == '0') {
        if (s[0][i + 1] == '0') {
          flag = true;
          s[0][i + 1] = 'X';
        } else if (s[1][i + 1] == '0') {
          flag = true;
          s[1][i + 1] = 'X';
        }
        if (flag) s[0][i] = 'X', s[1][i] = 'X';
      }
    }
    if (flag) ans++;
  }
  cout << ans << endl;
  return 0;
}
