public class Program
{
static void Main()
{
Solve();
}
public static void Solve()
{
var logFile = File.ReadAllLines("../../../Input.txt");
var logList = new List<string>(logFile);
List<int> nbrList = new List<int>(logList.Count);
foreach (var item in logList)
{
try
{
nbrList.Add(int.Parse(item));
}
catch
{
nbrList.Add(0);
}
}
List<int> sum = new List<int>(nbrList.Count) { 0 };
foreach (var n in nbrList)
{
if (n == 0)
{
sum.Add(0);
}
else
{
sum[sum.Count - 1] += n;
}
}
//Part 1
Console.WriteLine(sum.Max().ToString());
//Part 2
Console.WriteLine(sum.OrderByDescending(n => n).Take(3).Sum().ToString());
}
}