LOSTMAX: second test case help

I’ve been trying for a while somehow this works in the online ide and in other places as well. I saw some threads where it was telling about the newline feed but since it’s a beginner problem I glanced over other codes which work but I’m not sure what I am missing out. Maybe it’s stuck in some infinite loop?

Try doing this with getline() in c++. It might be possible that second test case doesnt have a endline char at end, which can cause your while loop to be infinite causing a SIGBRT error.

//