Created
December 7, 2017 09:52
-
-
Save roccodev/31944a403b4acf199d8c6e86a5caa43b to your computer and use it in GitHub Desktop.
AdventOfCode2017/Day7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List<String> bloccs = Files.readAllLines(Paths.get(new File("res/day7").getPath())).stream().collect(Collectors.toList()); | |
| List<String> othertings = new ArrayList<String>(); | |
| for(String s : bloccs) { | |
| if(s.contains("->")) { | |
| String[] ting = s.split("->")[1].split(","); | |
| for(String s1 : ting) { | |
| othertings.add(s1.trim()); | |
| } | |
| } | |
| } | |
| for(String s : bloccs) { | |
| if(s.contains("->")) { | |
| s = s.split("->")[0].trim().replaceAll("\\(.*\\)", "").trim(); | |
| if(!othertings.contains(s)) { | |
| System.out.println("Result: " + s); | |
| return; | |
| } | |
| } | |
| else { | |
| continue; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment