From 9d43ed0e655e13bdcd1236ab44325c3b70ebcd65 Mon Sep 17 00:00:00 2001 From: raj-humble <35659984+raj-humble@users.noreply.github.com> Date: Sun, 28 Oct 2018 17:24:36 +0530 Subject: [PATCH] Update codechef3.java --- codechef3.java | 68 +++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/codechef3.java b/codechef3.java index 57cabd9..1804cc6 100644 --- a/codechef3.java +++ b/codechef3.java @@ -1,48 +1,42 @@ +import java.util.*; +import java.lang.*; +import java.io.*; -Home » Reversing directions » All Submissions » harry_8652 [18971226] -Solution: 18971226 +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 a = new ArrayList<>(); - for(int j=0; j a = new ArrayList<>(); + for(int j=0; j0; j--) + { + if(a.get(j).startsWith("Left")) { - a.add(scan.nextLine()); + System.out.println("Right"+a.get(j-1).substring(a.get(j-1).indexOf(" "))); } - - System.out.println("Begin"+a.get(n-1).substring(a.get(n-1).indexOf(" "))); - for(int j=n-1; j>0; j--) + else { - 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("Left"+a.get(j-1).substring(a.get(j-1).indexOf(" "))); } - System.out.println(); } - - - } + System.out.println(); + } + + } +}