Skip to content

Instantly share code, notes, and snippets.

@jgsamudio
Last active May 17, 2019 21:07
Show Gist options
  • Save jgsamudio/e65e78942263a16f8f4a59951976cc92 to your computer and use it in GitHub Desktop.
Save jgsamudio/e65e78942263a16f8f4a59951976cc92 to your computer and use it in GitHub Desktop.
CodeJam - "You Can Go Your Own Way" Solution
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int t = in.nextInt();
for (int i = 1; i <= t; ++i) {
int gridSize = in.nextInt();
String otherPersonPath = in.next();
String path = "";
for (int j=0; j<otherPersonPath.length(); j++) {
char stepChar = otherPersonPath.charAt(j);
if (stepChar == 'E') {
path += "S";
} else {
path += "E";
}
}
System.out.println("Case #" + i + ": " + path);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment