#include <bits/stdc++.h>
int main() {
  char a[1010], b[1010];
  fgets(a, 1010, stdin);
  fgets(b, 1010, stdin);
  if (strcmp(a, b) != 0) {
    int original = 0, post = 0, i;
    for (i = 0; i < strlen(a) - 1; i++) original += a[i] - '0';
    for (i = 0; i < strlen(b) - 1; i++) {
      if (b[i] - '0') {
        if ((original + post) % 2) {
          post++;
          continue;
        }
        if (original > 0) {
          original--;
          post++;
        } else
          break;
      } else {
        if ((original + post) % 2 == 0) continue;
        if (original <= 0) break;
      }
    }
    if (i < strlen(b) - 1) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
}
