import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.util.concurrent.AtomicLongMap;

public class Day6 {

    public static void main(String[] args) throws IOException {
        Path path = Paths.get("src/main/java/input6.txt");
        List<String> input = Files.readAllLines(path).stream()
                .map(StringUtils::stripToEmpty)
                .collect(Collectors.toList());

        System.out.println("Running 1...");
        problem1(input);
        problem2(input);
    }

    public static void problem1(List<String> input) {
        ListMultimap<Integer, Character> totals = ArrayListMultimap.create();

        for (String line : input) {
            int pos = 0;
            for (char ch : line.toCharArray()) {
                totals.put(pos++, ch);
            }
        }

        System.out.println(totals);

        String message = "";
        for (int pos : totals.keySet()) {
            List<Character> list = totals.get(pos);

            AtomicLongMap<Character> hash = AtomicLongMap.create();
            long most = 0;
            char letter = 0;
            for (char ch : list) {
                long value = hash.incrementAndGet(ch);
                if (value > most) {
                    letter = ch;
                    most = value;
                }
            }

            message += letter;
        }

        System.out.println(message);
    }

    public static void problem2(List<String> input) {
        ListMultimap<Integer, Character> totals = ArrayListMultimap.create();

        for (String line : input) {
            int pos = 0;
            for (char ch : line.toCharArray()) {
                totals.put(pos++, ch);
            }
        }

        System.out.println(totals);

        String message = "";
        for (int pos : totals.keySet()) {
            List<Character> list = totals.get(pos);

            AtomicLongMap<Character> hash = AtomicLongMap.create();
            for (char ch : list) {
                hash.incrementAndGet(ch);
            }

            long most = Long.MAX_VALUE;
            char letter = 0;
            for (char ch : list) {
                if (hash.get(ch) < most) {
                    most = hash.get(ch);
                    letter = ch;
                }
            }

            message += letter;
        }

        System.out.println(message);
    }
}

@@ -153,25 +153,150 @@
 til.
-stream.Collectors
+Map;%0D%0Aimport java.util.Map.Entry;%0D%0Aimport java.util.function.Function;%0D%0Aimport java.util.stream.Collectors;%0D%0Aimport java.util.stream.IntStream
 ;%0D%0A%0D
@@ -827,41 +827,56 @@
     
-System.out.println(%22Running 1...%22
+problem1(input);%0D%0A        problem1_streams(input
 );%0D%0A
@@ -882,33 +882,33 @@
 %0A        problem
-1
+2
 (input);%0D%0A      
@@ -909,32 +909,40 @@
         problem2
+_streams
 (input);%0D%0A    %7D%0D
@@ -1265,47 +1265,8 @@
 %0D%0A%0D%0A
-        System.out.println(totals);%0D%0A%0D%0A
     
@@ -1834,32 +1834,647 @@
 age);%0D%0A    %7D%0D%0A%0D%0A
+    public static void problem1_streams(List%3CString%3E input) %7B%0D%0A%0D%0A        IntStream.range(0, 8).forEach(index -%3E %7B%0D%0A            Map%3CCharacter, Long%3E totals = input.stream()%0D%0A                    .map(s -%3E s.charAt(index))%0D%0A                    .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));%0D%0A%0D%0A            char ch = totals.entrySet().stream()%0D%0A                    .max((e1, e2) -%3E Long.compare(e1.getValue(), e2.getValue()))%0D%0A                    .map(Entry::getKey)%0D%0A                    .get();%0D%0A%0D%0A            System.out.print(ch);%0D%0A        %7D);%0D%0A%0D%0A        System.out.println();%0D%0A    %7D%0D%0A%0D%0A
     public stati
@@ -2778,47 +2778,8 @@
 %0D%0A%0D%0A
-        System.out.println(totals);%0D%0A%0D%0A
     
@@ -3419,12 +3419,623 @@
 %0D%0A    %7D%0D
+%0A%0D%0A    public static void problem2_streams(List%3CString%3E input) %7B%0D%0A        IntStream.range(0, 8).forEach(index -%3E %7B%0D%0A            Map%3CCharacter, Long%3E totals = input.stream()%0D%0A                    .map(s -%3E s.charAt(index))%0D%0A                    .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));%0D%0A%0D%0A            char ch = totals.entrySet().stream()%0D%0A                    .min((e1, e2) -%3E Long.compare(e1.getValue(), e2.getValue()))%0D%0A                    .map(Entry::getKey)%0D%0A                    .get();%0D%0A%0D%0A            System.out.print(ch);%0D%0A        %7D);%0D%0A        System.out.println();%0D%0A    %7D%0D
 %0A%7D%0D%0A

Add Java8 stream solutions to Day6