아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Deletive Editing

면접 대비

시간 제한3초메모리 제한512 MB

요약
단어 s에서 불린 글자의 첫 번째 위치를 반복해 지울 때 t를 만들 수 있는지 판정한다.
난이도

보통10점 중 4점

유형
그리디, 문자열, 구현
정답자
아직 제출이 없습니다

문제

Daisy loves playing games with words. Recently, she has been playing the following Deletive Editing word game with Daniel.

Daisy picks a word, for example, "DETERMINED". On each game turn, Daniel calls out a letter, for example, 'E', and Daisy removes the first occurrence of this letter from the word, getting "DTERMINED". On the next turn, Daniel calls out a letter again, for example, 'D', and Daisy removes its first occurrence, getting "TERMINED". They continue with 'I', getting "TERMNED", with 'N', getting "TERMED", and with 'D', getting "TERME". Now, if Daniel calls out the letter 'E', Daisy gets "TRME", but there is no way she can get the word "TERM" if they start playing with the word "DETERMINED".

Daisy is curious if she can get the final word of her choice, starting from the given initial word, by playing this game for zero or more turns. Your task it help her to figure this out.

입력

The first line of the input contains an integer nn --- the number of test cases (1≤n≤10,0001 \le n \le 10\\,000). The following nn lines contain test cases.

Each test case consists of two words ss and tt separated by a space. Each word consists of at least one and at most 30 uppercase English letters; ss is the Daisy's initial word for the game; tt is the final word that Daisy would like to get at the end of the game.

출력

Output nn lines to the output --- a single line for each test case. Output "YES" if it is possible for Daisy to get from the initial word ss to the final word tt by playing the Deletive Editing game. Output "NO" otherwise.

예제1

  1. 예제 1

    입력
    6
    DETERMINED TRME
    DETERMINED TERM
    PSEUDOPSEUDOHYPOPARATHYROIDISM PEPA
    DEINSTITUTIONALIZATION DONATION
    CONTEST CODE
    SOLUTION SOLUTION
    
    예상 출력
    YES
    NO
    NO
    YES
    NO
    YES