Anagram Check
Anagram Check
Two words are anagrams when one can be rearranged into the other — they use exactly the same letters the same number of times. listen and silent are anagrams; hello and world are not.
You are given two words on two separate lines, each made only of lowercase English letters. Print Yes if they are anagrams, otherwise print No.
Words of different lengths can never be anagrams.
Counting letters beats sorting for understanding: build a count of each letter for both words and compare the two counts.
Line 1: the first word. Line 2: the second word. Both are lowercase letters only.
The word Yes or the word No.
1 <= length of each word <= 10^5
listen silent
Yes
Both words use e, i, l, n, s and t exactly once.
Submit runs your code against 6 test cases — the 1 shown above plus 5 hidden ones covering the awkward cases. Run sample just tries the first example, which is usually what you want while you are still working it out.