← 返回 uber 的题目列表Robot Bounded In Circle
类型:online_judge
Problem: Robot Bounded In Circle
You are given a string instructions consisting only of 'G', 'L', and 'R':
'G': move forward by one unit in the current direction;
'L': turn left by 90 degrees;
'R': turn right by 90 degrees.
The robot starts at (0, 0) facing north. It repeats the instruction string forever.
Determine whether the robot's path is bounded within some circle. Return true if it is bounded, otherwise return false.
Input Format
One line containing the string instructions.
Output Format
Print true or false.
Constraints
1 <= len(instructions) <= 10^4
instructions[i] ∈ {'G', 'L', 'R'}
Example
Input
GGLLGG
Output
true