#include <bits/stdc++.h>
using namespace std;
bool check1(string a) {
  for (long long int i = 0; i < a.length(); i++) {
    if (a[i] != '0') {
      return false;
    }
  }
  return true;
}
int main() {
  string a, b;
  cin >> a >> b;
  if (a == b) {
    cout << "YES";
    return 0;
  }
  if (a.length() != b.length()) {
    cout << "NO";
    return 0;
  }
  if (check1(a) || check1(b)) {
    cout << "NO";
    return 0;
  }
  cout << "YES";
  return 0;
}
