#K85317. Transform String via Adjacent Swaps
Transform String via Adjacent Swaps
Transform String via Adjacent Swaps
Given two strings (s) and (t), determine if it is possible to transform (s) into (t) by swapping any two adjacent characters any number of times. Note that swapping adjacent characters can produce any permutation of the string, so the transformation is possible if and only if the two strings have exactly the same multiset of characters.
For example, if (s = \texttt{abdc}) and (t = \texttt{dabc}), then the transformation is possible because both strings have the same characters, even though their orders differ. Otherwise, if the strings have different character counts, output "NO".
inputFormat
The input consists of two lines. The first line contains the string (s) and the second line contains the string (t). Both strings consist of lowercase English letters.
outputFormat
Output a single line containing either "YES" if it is possible to transform (s) into (t) by swapping adjacent characters, or "NO" if it is not possible.## sample
abdc
dabc
YES