Well you don't usually read the text and then split it line by line. Instead, you read the text line by line in the first place, using the getline function
std::string line;
std::getline(std::cin, line);
You can choose to store all the lines in a vector of strings, however, in order to find the longest string, you don't have to store all of them. You can just compare the current line's length with a saved "longest line" or the length thereof.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…