#include <bits/stdc++.h>
using namespace std;
int n, dp[110][4];
string s1, s2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> s1 >> s2;
  n = s1.length();
  for (int i = 1; i < n; ++i) {
    if (s1[i] == '0' and s1[i - 1] == s2[i - 1] and s1[i - 1] == '0') {
      dp[i][1] = dp[i - 1][0] + 1;
    }
    if (s2[i] == '0' and s1[i - 1] == s2[i - 1] and s1[i - 1] == '0') {
      dp[i][2] = dp[i - 1][0] + 1;
    }
    if (s1[i] == s2[i] and s1[i] == '0') {
      if (s1[i - 1] == '0' and s2[i - 1] == '0')
        dp[i][3] = max(dp[i][3], dp[i - 1][1] + 1);
      if (s2[i - 1] == '0' and s1[i - 1] == '0')
        dp[i][3] = max(dp[i][3], dp[i - 1][2] + 1);
      if (s2[i - 1] == '0' or s1[i - 1] == '0')
        dp[i][3] = max(dp[i][3], dp[i - 1][0] + 1);
    }
    dp[i][0] =
        max(max(dp[i - 1][0], dp[i - 1][1]), max(dp[i - 1][2], dp[i - 1][3]));
  }
  cout << max(max(dp[n - 1][0], dp[n - 1][1]), max(dp[n - 1][2], dp[n - 1][3]));
}
