#C5707. Subsequence Anagram Finder
Subsequence Anagram Finder
Subsequence Anagram Finder
Given two strings \(s_1\) and \(s_2\), determine whether \(s_1\) contains a contiguous subsequence that is an anagram of \(s_2\). In other words, check if there exists a substring of \(s_1\) (of length equal to \(s_2\)) whose characters can be rearranged to form \(s_2\).
For each test case, output YES
if such a substring is found, or NO
if not.
Note: An anagram is a permutation of the characters. All characters in the strings are lowercase English letters.
inputFormat
The first line of input contains an integer (T), the number of test cases. Each test case consists of two lines: the first line contains the string (s_1) and the second line contains the string (s_2).
outputFormat
For each test case, print a single line containing YES
if (s_1) has a contiguous subsequence that is an anagram of (s_2), or NO
otherwise.## sample
3
abcdef
bca
aaaaaa
aaa
abcbac
bca
YES
YES
YES
</p>