Subsequence matching
Submissions: 3527   Accuracy:

37.63%

  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


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

to report an issue on this page.