#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ss = stringstream;
using ul = unsigned long long;
template <typename T>
inline T LCM(T a, T b) {
  return (a * b) / GCD(a, b);
}
template <typename T>
inline T GCD(T a, T b) {
  ll t;
  while (a) {
    t = a;
    a = b % a;
    b = t;
  }
  return b;
}
template <typename T>
inline T _max(T a, T b, T c) {
  return max(max(a, b), c);
}
template <typename T>
inline T _min(T a, T b, T c) {
  return min(min(a, b), c);
}
template <typename T>
inline string toString(T a) {
  return to_string(a);
}
template <typename T>
inline void toInt(string s, T &x) {
  ss str(s);
  str >> x;
}
inline void lower(string &s) {
  for (__typeof((s).begin()) it = (s).begin(); it != (s).end(); ++it)
    *it = tolower(*it);
}
inline void upper(string &s) {
  for (__typeof((s).begin()) it = (s).begin(); it != (s).end(); ++it)
    *it = toupper(*it);
}
const int mod = 1e9 + 7;
inline ll add(ll x, ll y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline ll sub(ll x, ll y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }
inline ll powr(ll a, ll b) {
  ll x = 1LL;
  while (b) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline ll inv(ll a) { return powr(a, mod - 2); }
const int inv2 = (mod + 1) >> 1;
const ll inf = 999999999999999999;
bool palin(string s) {
  string s1 = s;
  reverse(s.begin(), s.end());
  return (s == s1);
}
ll triangle(ll n) { return (n * (n + 1)) / 2; }
bool check(ll n) {
  if (n == 1) return 0;
  if (n == 2 or n == 3) return 1;
  if (n % 2 == 0 or n % 3 == 0) return 0;
  for (ll i = 5; i * i <= n; i += 6)
    if (n % i == 0 or n % (i + 2) == 0) return 0;
  return 1;
}
string s[2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n = 2;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  n = s[0].length();
  int i = 0;
  int ans = 0;
  int u = 0, v = 0;
  while (i < n) {
    int cnt = 0;
    if (s[0][i] == '0' and s[1][i] == '0') {
      if (min(u, v) == 0 and max(u, v) == 1) {
        ans++;
        i++;
        u = 0, v = 0;
      }
    }
    while ((s[0][i] == '0' and s[1][i] == '0') and i < n) {
      i++;
      cnt++;
    }
    if (cnt > 0 and cnt % 3 == 0) {
      ans += (cnt / 3) * 2;
    } else if (cnt > 0) {
      if (cnt % 3 == 1) {
        if ((u == 0 and v == 1) or (u == 1 and v == 0)) {
          ans++;
          u = 0, v = 0;
        } else {
          u = 1, v = 1;
        }
      } else if (cnt % 3 == 2) {
        u = 1, v = 0;
        ans++;
      }
      int l = (cnt - (cnt % 3));
      ans += (l / 3) * 2;
    } else if (cnt == 0) {
      if ((s[0][i] == 'X' and s[1][i] == '0') or
          (s[0][i] == '0' and s[1][i] == 'X')) {
        if (u == 1 and v == 1) {
          if (s[0][i] == 'X' and s[1][i] == '0') {
            v = 0, u = 0;
            ans++;
          } else if (s[0][i] == '0' and s[1][i] == 'X') {
            ans++;
            u = 0, v = 0;
          }
        } else {
          u = 0, v = 1;
        }
      } else if (s[0][i] == 'X' and s[1][i] == 'X') {
        u = 0, v = 0;
      }
      i++;
    }
  }
  cout << ans;
  cout << "\n";
  return 0;
}
