Subsequence matching
Submissions: 4743   Accuracy:

36.69%

  Difficulty: Medium   Marks: 4

Given an all upper case string, check if it is a combination of one or more of the following:
1) R
2) RY
3) RYY

Input:

First line contains an integer T denoting the number of test cases. Each of the following T lines will contain an upper case string.

Output:

Print YES if the sequence is correct, NO if not correct.

Constraints:  

1<=T<=100
1<=10^5<= Size of String

Example: 

Input:

3
RY
RWR
RRYY

Output:

YES
NO
YES

** For More Input/Output Examples Use 'Expected Output' option **

Author: jain_rishabh


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.