Problems > Anagram Check

Anagram Check

Difficulty: 900 2000 ms 128 MB

strings

Are the two strings anagrams — do they contain exactly the same multiset of characters?

Input: two lines, each with a lowercase string.

Output: YES or NO.

Constraints:

  • 1 ≤ |A|, |B| ≤ 104

Sample Tests

Input 1
listen
silent
Output 1
YES
Input 2
aab
abb
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.