Leaderboard
Showing:
Handle Score
@Ibrahim Nash 5725
@blackshadows 5685
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Complete Leaderboard
Subsequence matching
Medium Accuracy: 36.7% Submissions: 7509 Points: 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

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Subsequence matching

Output Window