import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
public static void main
( String[] args
) { Scanner in
= new Scanner
( System.
in ); word1 = in.nextLine();
word2 = in.nextLine();
if ( sort ( word1 ).equals( sort ( word2 ) ) ) {
} else System.
out.
print( "NO" ); }
char[] content = word1.toCharArray();
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBNYWluCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluICggU3RyaW5nW10gYXJncyApCXsKCQlTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoIFN5c3RlbS5pbiApOwoJCVN0cmluZyB3b3JkMSwgd29yZDI7CgkJd29yZDEgPSBpbi5uZXh0TGluZSgpOwoJCXdvcmQyID0gaW4ubmV4dExpbmUoKTsKICAgICAgIAlpZiAoIHNvcnQgKCB3b3JkMSApLmVxdWFscyggc29ydCAoIHdvcmQyICkgKSApIHsKICAgICAgIAkJU3lzdGVtLm91dC5wcmludCggIllFUyIgKTsKICAgICAgIAl9IGVsc2UgU3lzdGVtLm91dC5wcmludCggIk5PIiApOyAKCX0KCXN0YXRpYyBTdHJpbmcgc29ydCggU3RyaW5nIHdvcmQxICkgewogICAgY2hhcltdIGNvbnRlbnQgPSB3b3JkMS50b0NoYXJBcnJheSgpOwogICAgQXJyYXlzLnNvcnQoIGNvbnRlbnQgKTsKICAgIHJldHVybiBuZXcgU3RyaW5nKCBjb250ZW50ICk7Cgl9Cn0=