#include <bits/stdc++.h>
using namespace std;
char a[1000010], b[1000010];
int main() {
  int i, n, sa = 0, sb = 0, j;
  scanf("%s %s", a, b);
  while (a[sa] != '\0') sa++;
  while (b[sb] != '\0') sb++;
  if (sa != strlen(a) || sb != strlen(b)) {
    printf("sa = %d strlen = %d\nsb = %d strlen = %d\n", sa, strlen(a), sb,
           strlen(b));
  }
  for (i = 0; i < sa && a[i] == '0'; i++)
    ;
  for (j = 0; j < sb && b[j] == '0'; j++)
    ;
  if (!strcmp(a, b))
    printf("YES");
  else if (sa != sb || i == sa || j == sb)
    printf("NO");
  else
    printf("YES");
  return 0;
}
