how to store array of string with spaces in c++ stl

#include <iostream>
#include <vector>
#include <string>

int main() {
    // Step 1: Declare a vector to store strings
    std::vector<std::string> stringArray;

    // Step 2: Read input strings with spaces and store in the vector
    std::string inputString;
    std::cout << "Enter strings with spaces (type 'exit' to stop):" << std::endl;

    while (true) {
        std::getline(std::cin, inputString);
        if (inputString == "exit") {
            break;
        }
        stringArray.push_back(inputString);
    }

    // Step 3: Display the stored strings
    std::cout << "Stored strings:" << std::endl;
    for (const auto& str : stringArray) {
        std::cout << str << std::endl;
    }

    return 0;
}