Skip to content

Instantly share code, notes, and snippets.

@roccodev
Created December 7, 2017 09:52
Show Gist options
  • Select an option

  • Save roccodev/31944a403b4acf199d8c6e86a5caa43b to your computer and use it in GitHub Desktop.

Select an option

Save roccodev/31944a403b4acf199d8c6e86a5caa43b to your computer and use it in GitHub Desktop.
AdventOfCode2017/Day7
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