28. Valid Anagram
EasyStringHash MapSorting
Print YES if string t is an anagram of string s (same letters with the same counts), otherwise NO.
Input format
Line 1: s Line 2: t
Output format
YES or NO.
Example 1
Input
anagram nagaram
Output
YES
Example 2
Input
rat car
Output
NO
Constraints
1 ≤ |s|, |t| ≤ 5 × 10⁴, lowercase letters
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…