-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDIRECTN.java
29 lines (28 loc) · 903 Bytes
/
DIRECTN.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class DIRECTN{
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(br.readLine());
while(tc>0)
{
tc--;
int n = Integer.parseInt(br.readLine());
String in = br.readLine();
boolean isSouth=false;
for(int i =1;i<in.length();i++)
{
if(in.charAt(i)=='L'&&in.charAt(i-1)=='L')
{
isSouth = true;break;
}
if(in.charAt(i)=='R'&&in.charAt(i-1)=='R')
{
isSouth = true;break;
}
}
System.out.println(isSouth==true?"YES":"NO");
}
}
}