Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t=int(input(''))
- for i in range(t):
- x=int(input(''))
- a=input('')
- w=[]
- for i in range(0,x-2):
- for j in range(i,x+1):
- w.append(a[i:j])
- for i in w:
- q=0
- for j in i:
- if j=='L':
- q+=1
- else:
- q-=1
- if abs(q)%2==0 and q!=0:
- print('YES')
- break
- else:
- pass
- else:
- print('NO')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement