import java.util.Scanner; class No_64{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String a = sc.next(); String b = sc.next(); int cnt = 0; int judge1 = 1; int judge2 = 1; for(int i = 0;i < a.length();i++){ char x = a.charAt(i); for(int t = 0;t < a.length();t++){ char y = b.charAt(t); if(x == y){ break; } cnt++; } if(cnt == a.length()){ judge1 = 0; break; } cnt = 0; } for(int i = 0;i < a.length();i++){ char x = b.charAt(i); for(int t = 0;t < a.length();t++){ char y = a.charAt(t); if(x == y){ break; } cnt++; } if(cnt == a.length()){ judge2 = 0; break; } cnt = 0; } if(judge1 == 1 && judge2 == 1){ System.out.println("YES"); }else{ System.out.println("NO"); } } }