#include <bits/stdc++.h>
using namespace std;
int N;
string S[2];
int dp[101][4];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> S[0] >> S[1];
  N = S[0].size();
  dp[0][1] = dp[0][2] = dp[0][3] = -1010;
  for (i = 0; i < (N); i++) {
    x = (S[0][i] == '0') + (S[1][i] == '0') * 2;
    for (j = 0; j < (4); j++) dp[i + 1][j] = -1010;
    for (j = 0; j < (4); j++) {
      dp[i + 1][x] = max(dp[i + 1][x], dp[i][j]);
      if (j == 3) {
        if (x & 1) dp[i + 1][x ^ 1] = max(dp[i + 1][x ^ 1], dp[i][j] + 1);
        if (x & 2) dp[i + 1][x ^ 2] = max(dp[i + 1][x ^ 2], dp[i][j] + 1);
      }
      if (j && x == 3) dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + 1);
    }
  }
  cout << max({dp[N][0], dp[N][1], dp[N][2], dp[N][3]}) << endl;
  ;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
