import { readFileSync } from 'fs'; import { join } from 'path'; const fileString = readFileSync(join(__dirname, "input"), 'utf-8'); const rawCalories = fileString.split("\n\n"); var parsedCalories = []; for (const calorieData of rawCalories) { var total: number = 0; const calorieStringArray = calorieData.split("\n"); for (const calorie of calorieStringArray) { const c: number = +calorie; total += c; } parsedCalories.push(total); } console.log(Math.max(...parsedCalories));