#include <bits/stdc++.h>
using namespace std;
string s[2];
int n;
int dp[101];
int main() {
  cin >> s[0] >> s[1];
  int n = s[0].size();
  memset(dp, 0, sizeof dp);
  for (int i = 1; i < n; ++i) {
    dp[i + 1] = dp[i];
    char c00 = s[0][i - 1];
    char c01 = s[0][i];
    char c10 = s[1][i - 1];
    char c11 = s[1][i];
    if (c00 == '0' && c10 == '0' && (c01 == '0' || c11 == '0'))
      dp[i + 1] = max(dp[i + 1], dp[i - 1] + 1);
    if (c01 == 'X' || c11 == 'X') continue;
    if (c00 == 'X' && c10 == 'X') continue;
    dp[i + 1] = max(dp[i + 1], dp[i - 1] + 1);
    if (i == 1) continue;
    if (c00 == 'X' || c10 == 'X') continue;
    if (s[0][i - 2] == 'X' || s[1][i - 2] == 'X') continue;
    dp[i + 1] = max(dp[i + 1], dp[i - 2] + 2);
  }
  cout << dp[n] << endl;
}
