1
0
Fork 0
Advent2022/Day1/part1.cpp

25 lines
448 B
C++

#include <iostream>
#include <string>
int main(int argc, char* argv[])
{
std::string line;
int total = 0;
int max = 0;
while(std::getline(std::cin, line))
{
if (0 == line.size())
{
if (total > max)
{
max = total;
}
total = 0;
}
else
{
total += stoi(line);
}
}
std::cout << max << std::endl;
}