#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  bool can = false;
  if (a.length() == b.length()) {
    int ia = 0, ib = 0;
    while (ia < a.length() && a[ia] == '0') ++ia;
    while (ib < b.length() && b[ib] == '0') ++ib;
    if ((ia < a.length() && ib < b.length()) ||
        (ia == a.length() && ib == b.length()))
      can = true;
  }
  if (can)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
