use std::env;
use std::fs::File;
use std::io::{BufRead,BufReader};

fn main() {
    let filename = "input_day1_1.txt";
    let file = File::open(filename).unwrap();
    let reader = BufReader::new(file);
    let mut list = Vec::new();
    let mut temp: i32 = 0;
    for(index,line) in reader.lines().enumerate(){
        let line = line.unwrap();
        if(line.eq("")){
            list.push(temp);
            temp = 0;
        }else{
            temp += line.parse::<i32>().unwrap();
        }
    }
    list.sort();
    let length = list.len();
    println!("part1:");
    println!("{}",list[length - 1]);
    let top3 = list[length - 1] + list[length - 2] + list[length - 3];
    println!("");
    println!("part2:");
    println!("{}",top3);
}
