시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 41 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
W3sicHJvYmxlbV9pZCI6Ijk1NDkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1NTRcdWQ2MzhcdWQ2NTRcdWI0MWMgXHViZTQ0XHViYzAwXHViYzg4XH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