import java.util.*; class mojinarabi{ public static void main(String args[]){ Scanner s = new Scanner(System.in); String a = s.next(); String b = s.next(); char A[] = a.toCharArray(); char B[] = b.toCharArray(); ArrayList arrayA = new ArrayList(); ArrayList arrayB = new ArrayList(); for(int i = 0; i < A.length; i++){ arrayA.add(String.valueOf(A[i])); arrayB.add(String.valueOf(B[i])); } Collections.sort(arrayA); Collections.sort(arrayB); for(int i = 0; i < arrayA.size(); i++){ if(!(arrayA.get(i).equals(arrayB.get(i)))){ System.out.println("NO"); System.exit(0); } } System.out.println("YES"); } }