class Solution:
def isRobotBounded(self, ins: str) -> bool:
dx, dy = [0,1,0,-1], [1,0,-1,0]
def check(i):
x, y, j = 0, 0, 0
for c in i:
if c == "G":
x, y = x + dx[j], y + dy[j]
elif c == "L":
j = (j + 3)%4
else:
j = (j + 1)%4
return x == 0 and y == 0
return check(ins) or check(ins*2) or check(ins*4)
1.