#K8006. Anagram Swap Equivalence
Anagram Swap Equivalence
Anagram Swap Equivalence
Given two strings, determine whether they can be made equal by swapping any two characters in each string. In other words, check if they are anagrams. Two strings \( s_1 \) and \( s_2 \) can be deemed equivalent if and only if they have the same multiset of characters, i.e., \( sorted(s_1) = sorted(s_2) \). This problem requires you to implement the solution by reading from standard input and outputting the result to standard output.
inputFormat
The input is read from standard input (stdin) and consists of two lines. The first line contains the string ( s_1 ) and the second line contains the string ( s_2 ). The strings may contain any characters.
outputFormat
Print "YES" to standard output (stdout) if the two strings are anagrams (i.e. if ( sorted(s_1) = sorted(s_2) )). Otherwise, print "NO".## sample
abc
bca
YES