src/main/java/com/thiyagu_7/adventofcode/year2020/day7/SolutionDay7.java
private Node buildNode(String s) {
        int index = s.indexOf(" ");
        int count = Integer.parseInt(s.substring(0, index));
        String bagName = s.substring(index).trim();
        String name = bagName.substring(0, bagName.indexOf(" bag"));
        return new Node(name, count);
    }
//1 dark olive bag or 5 faded blue bags
1 dark olive bag or 5 faded blue bags
1 dark olive bag or 5 faded blue bags
private Node buildNode(String s) {
        int index = s.indexOf(" ");
        int count = Integer.parseInt(s.substring(0, index));
        String bagName = s.substring(index).trim();
        String name = bagName.substring(0, bagName.indexOf(" bag"));
        return new Node(name, count);
    }
private Node buildNode ( String s ) { int index = s . indexOf ( " " ) ; int count = Integer . parseInt ( s . substring ( 0 , index ) ) ; String bagName = s . substring ( index ) . trim ( ) ; String name = bagName . substring ( 0 , bagName . indexOf ( " bag" ) ) ; return new Node ( name , count ) ; }
1 dark olive bag or 5 faded blue bags
1 dark olive bag or 5 faded blue bags