#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000000 + 7;
long long power(long long x, long long y) {
  long long res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
void fun() {}
bool isPrime(long long n) {
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long find_dist(string s, string t, long long m, long long n) {
  if (n == 0) return m;
  if (m == 0) return n;
  if (s[m - 1] == t[n - 1]) return find_dist(s, t, m - 1, n - 1);
  return 1 + min({find_dist(s, t, m - 1, n), find_dist(s, t, m, n - 1),
                  find_dist(s, t, m - 1, n - 1)});
}
long long functionn(long long x, long long h, long long y, long long a,
                    long long m) {
  for (long long i = 1; i <= m; i++) {
    long long val = (x * h + y) % m;
    h = val;
    if (val == a) return i;
  }
  return -1;
}
const long long N = 5007;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  fun();
  long long tt = 1;
  while (tt--) {
    string s, t;
    cin >> s >> t;
    long long c = 0;
    for (long long i = 0; i < s.length(); i++) {
      if (s[i] == '0' and s[i + 1] == '0') {
        if (t[i] == '0') {
          c++;
          t[i] = '$', s[i] = '$', s[i + 1] = '$';
        } else if (t[i + 1] == '0') {
          c++;
          t[i + 1] = '$', s[i] = '$', s[i + 1] = '$';
        }
      } else if (t[i] == '0' and t[i + 1] == '0') {
        if (s[i] == '0') {
          c++;
          s[i] = '$', t[i] = '$', t[i + 1] = '$';
        } else if (s[i + 1] == '0') {
          c++;
          s[i + 1] = '$', t[i] = '$', t[i + 1] = '$';
        }
      }
    }
    cout << c;
  }
  return 0;
}
