Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/string-anagramma

Anagram?

Medium 1000 ms 128 MB 46%
Share

Two words $a$ and $b$ of lowercase Latin letters are given. They are anagrams if $b$ can be made by rearranging the letters of $a$ (using each exactly once). Determine whether the words are anagrams.

Checking that two words consist of exactly the same letters

Input

The first line contains $a$, the second line $b$.

Output

YES if they are anagrams, otherwise NO.

Note

$1 \le |a|, |b| \le 10^{5}$
$a$ and $b$ consist of lowercase Latin letters only

Examples

Input #1
listen
silent
Output #1
YES
Input #2
abc
abd
Output #2
NO

Sign in to submit a solution

Signing up is free and takes a minute.