Amplitude Hackathon Summer '25 Problem 2 - AI (Also Easy)

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type

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 s if and only if there exist indices i and j where i < j, s_i = A and s_j = I.

Given a string, determine if Spenser likes it!

Constraints

1 \le T \le 10^4

1 \le |s| \le 50

Input Specification

The first line contains a single integer, T.

The next T lines each contain a single string s of uppercase letters.

Output Specification

Output T lines. On the i^{\text{th}} line, output YES if Spenser likes the i^{\text{th}} string. Otherwise, output NO.

Sample Input 1

4
AMPLITUDEISALLINONAI
AMPLITUDE
AI
IA

Sample Output 1

YES
YES
YES
NO

Comments

There are no comments at the moment.