Does robot moves circular
Submissions: 3028   Accuracy:

43.91%

  Difficulty: Easy   Marks: 2

Given a sequence of moves for a robot, check if the sequence is circular or not. A sequence of moves is circular if first and last positions of robot are same. A move can be on of the following.
    
    G - Go one unit
    L - Turn left
    R - Turn right

Input:

The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is a String in capital letter, sequence of moves consisting only {R,G,L}.

Output:

Print Given sequence of moves is circular if first and last positions of robot are same. else Given sequence of moves is NOT circular.

Constraints:

1 ≤ T ≤ 50
1 ≤ size of string ≤ 200

Example:

Input:
3
GLGLGLG
GLLG
GGGGL

Output:
Circular
Circular
Not Circular

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

Author: rajatjha


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.