-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcodechef3.java
More file actions
48 lines (37 loc) · 1.39 KB
/
codechef3.java
File metadata and controls
48 lines (37 loc) · 1.39 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Home » Reversing directions » All Submissions » harry_8652 [18971226]
Solution: 18971226
CodeChef submission 18971226 (JAVA) plaintext list. Status: AC, problem DIRECTI, contest CODECHEF. By harry_8652 (harry_8652), 2018-06-23 21:27:19.
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
for(int i=0;i<t;i++)
{
int n = scan.nextInt();
scan.nextLine();
ArrayList<String> a = new ArrayList<>();
for(int j=0; j<n ;j++)
{
a.add(scan.nextLine());
}
System.out.println("Begin"+a.get(n-1).substring(a.get(n-1).indexOf(" ")));
for(int j=n-1; j>0; j--)
{
if(a.get(j).startsWith("Left"))
{
System.out.println("Right"+a.get(j-1).substring(a.get(j-1).indexOf(" ")));
}
else
{
System.out.println("Left"+a.get(j-1).substring(a.get(j-1).indexOf(" ")));
}
}
System.out.println();
}
}
}