시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 39 18 14 60.870%

문제

새로운 암호화 알고리즘이 개발되었다.

우선, 모든 비밀번호는 항상 알파벳 소문자로만 이루어진다고 가정하자.

암호화 알고리즘은 다음과 같이 진행된다.

  1. 비밀번호의 서로 다른 두 글자를 교환한다. 이 과정은 0번 또는 원하는 만큼 얼마든지 할 수 있다.
  2. 1번 과정의 결과물 앞부분에 0개 혹은 그 이상의 문자를 삽입한다.
  3. 2번 과정의 결과물 뒷부분에 0개 혹은 그 이상의 문자를 삽입한다.

3번 과정의 결과물이 암호화된 비밀번호이다.

청호는 사용하던 비밀번호들을 위 알고리즘대로 다 암호화했다.

하지만 수작업이었던 탓에 실수가 있을 지도 모르기 때문에 프로그램을 작성하여 제대로 암호화했는지 확인해보려 한다.

암호화된 비밀번호와 원래의 비밀번호가 주어지면, 암호화된 비밀번호가 원래의 비밀번호를 위의 알고리즘대로 암호화한 결과물일 수 있는지 혹은 없는지를 알아내 보자.

입력

첫 줄에 테스트 케이스의 수 T가 주어진다. ( 1 ≤ T ≤ 100 )

각 테스트 케이스는 두 줄로 구성된다.

첫 줄엔 암호화된 결과물이 주어진다.

두번째 줄엔 원래의 비밀번호가 주어진다.

암호화된 비밀번호와 원래의 비밀번호는 1개 이상 10만개 이하의 문자로 이루어져 있으며, 항상 알파벳 소문자만을 포함한다.

암호화된 비밀번호의 길이는 항상 원래 비밀번호의 길이보다 크거나 같다.

출력

각 테스트 케이스마다, 원래의 비밀번호를 문제에서 설명한 알고리즘대로 암호화했을 때 주어진 결과물이 나올 수 있다면 YES를, 그렇지 않다면 NO를 출력한다.

예제 입력 1

3
abcdef
ecd
cde
ecd
abcdef
fcd

예제 출력 1

YES
YES
NO
W3sicHJvYmxlbV9pZCI6Ijk1NDkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1NTRcdWQ2MzhcdWQ2NTRcdWI0MWMgXHViZTQ0XHViYzAwXHViYzg4XHV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