This page is still under construction.

Parts of this page are still being built. What you see may change.

Letter Bank

Interview

Time limit1sMemory limit128 MB

Summary
Decide whether the second word uses exactly the letters of the first word, each at least once.
Level

Easy1 of 10

Topics
Hash map, String
Solved
No attempts yet

Problem

A letter bank is a word whose letters can each be used one or more times, as often as you like, to spell another word. For example, IMPS is a bank of MISSISSIPPI. The longer word uses only I, M, P, S, and it uses all four of them.

Given two words α and β, write a program that decides whether α is a bank of β. The first word α has no repeated letter. Both words consist only of capital letters A to Z, with no blanks.

Input

Your program reads from standard input. The first line contains the number of test cases TT (1≤T≤201 \le T \le 20). Each of the next TT lines holds two words separated by a single space. Each word has length at most 80.

Output

Your program writes to standard output. Print exactly one line for each test case: YES if the first word is a bank of the second word, and NO otherwise.

Examples1

  1. Example 1

    Input
    4
    IMPS MISSISSIPPI
    BLUE BLUE
    CNT COCONUT
    IPC PC
    
    Expected output
    YES
    YES
    NO
    NO