#C7948. Rearrange Strings to Form Anagrams

    ID: 51875 Type: Default 1000ms 256MiB

Rearrange Strings to Form Anagrams

Rearrange Strings to Form Anagrams

You are given two strings A and B. Your task is to determine whether string A can be rearranged to form string B.

In other words, check if A and B are anagrams of each other. Two strings are anagrams if they contain the same characters in any order.

Note: The comparison should be case-sensitive and the strings may contain only lowercase/uppercase letters.

Input/Output Example:

Input:
5
listen silent
apple pplea
triangle integral
hello ollhe
car ar

Output: YES YES YES YES NO

</p>

inputFormat

The input is given via standard input (stdin) and follows this format:

  1. An integer T, the number of test cases.
  2. T lines follow, each containing two strings separated by a space.

For example:
5
listen silent
apple pplea
triangle integral
hello ollhe
car ar

outputFormat

For each test case, output a single line containing either YES if the first string can be rearranged to form the second string, or NO otherwise.

The output is provided via standard output (stdout).

## sample
5
listen silent
apple pplea
triangle integral
hello ollhe
car ar
YES

YES YES YES NO

</p>