I have written a small program that takes inputs as string which is stored in a vector.
Looping through the vector causes many empty strings being printed before actual output.
I have copied the sample lines below.
This line of code has two issues:
vectorof size N default-initialized elements, as though you had called
reserveon the vector.
What you wanted was:
std::cin >> totalStrings; std::vector<std::string> testCases; testCases.reserve(totalStrings);