Intuitive Elements

면접 대비

시간 제한1초메모리 제한2048 MB

요약
각 테스트에서 짧은 약어 문자열의 모든 문자가 긴 원래 문자열에 들어 있는지 순서와 개수와 상관없이 판정한다.
난이도

쉬움10점 중 2점

유형
문자열, 해시맵, 구현
정답자
아직 제출이 없습니다

문제

Brandon is learning the periodic table! However, he doesn't like some of the elements because the symbol of the element contains letters which are not present in the name of the element. He finds this to be unintuitive, especially because in other contexts, he expects abbreviations to not introduce random letters.

Given a string and a proposed abbreviation, determine if Brandon would find it intuitive. Brandon finds an abbreviation intuitive if and only if every letter that appears in the abbreviation appears in the original string. Brandon does not look at the abbreviation carefully, so it is acceptable for a letter to appear more times in the abbreviation than in the original string, or for the letters to appear in a different order between the string and the abbreviation.

입력

The first line of input contains a single integer tt (1≤t≤1031\leq t \leq 10^3). This is the number of test cases.

Each test case is represented on two lines.

The first line of each test case contains a single string aa of length at least two and at most 50. This string only contains lowercase letters. The second line of the test case contains a single string bb that is strictly shorter than aa and also only contains lowercase letters.

출력

Output tt lines, one for each test case.

For each test case, if all the letters in bb appear in aa, output YES. Otherwise, output NO.

예제1

  1. 예제 1

    입력
    4
    magnesium
    mg
    silver
    ag
    aabb
    bbb
    aabb
    ba
    
    예상 출력
    YES
    NO
    YES
    YES