Anagram check
Two words are anagrams if they use exactly the same letters the same number of times. Ignoring case and spaces, print YES if the two lines are anagrams, otherwise NO.
Reported in: Infosys (2021–25), Accenture (memory-based)
Input
Two lines, one string each.
Output
YES or NO.
Constraints
1 ≤ length ≤ 10^5.
Example 1
Input:
Listen
Silent
Output:
YESExample 2
Input:
apple
papel s
Output:
NOHint: Compare sorted letters, or letter counts.