Amplitude is all in on AI!
Spenser is seeing AI everywhere. In particular, he likes strings if and only if AI
is a subsequence of the string. Formally, AI
is a subsequence of string
if and only if there exist indices
and
where
,
and
.
Given a string, determine if Spenser likes it!
Constraints
Input Specification
The first line contains a single integer, .
The next lines each contain a single string
of uppercase letters.
Output Specification
Output lines. On the
line, output
YES
if Spenser likes the string. Otherwise, output
NO
.
Sample Input 1
4
AMPLITUDEISALLINONAI
AMPLITUDE
AI
IA
Sample Output 1
YES
YES
YES
NO
Comments