#include #include #include #include using namespace std; int main() { string foodStr; ifstream inputFile("input.txt"); vector foodList; int elfFood {0}; while ( getline(inputFile, foodStr)) { if (foodStr == "") { foodList.push_back(elfFood); elfFood = 0; continue; } elfFood += stoi(foodStr); } sort(foodList.begin(), foodList.end()); int total {0}; for(int i {0}; i < 3; i++) { cout << foodList.back() << endl; total += foodList.back(); foodList.pop_back(); } cout << '\n' << total << endl; }