Step 6 of 6
Whole lines with getline
cin >> stops at whitespace. To read an entire line, spaces included, use std::getline:
std::string line;
std::getline(std::cin, line);
It returns something that converts to false at the end of input, so this reads every line:
while (std::getline(std::cin, line)) { ... }
Your turn: read lines until the end of input and print each one prefixed with its line number, like 1: first line. Then print total N.