Hello i have the following sentence which is in a string and in one Line but very long:
l-s-s---s-l---s-s-s-------s-l---l---l-s-s-s-s-l---l-l-s-s---s---s-s---l-s-l-s---s-s-s-s---s---l-s-------l-s-l-l-s---s-l-l-s-l-s---l-s-l-l-s-l-------     
(Its in Morse Code) The --- (3x-) seperates the letters and ------- (7x-) seperates the word. How can i cut the very long code in words.
I've tried the following:
    size_t posWordNext{};
    size_t posWordPre{};
    while (true) {
        posWordNext += code.find("-------");
        if (posWordNext >= code.size()) {
            break;
        }
        cout << code.substr(posWordPre, posWordNext) << endl;
        posWordPre = posWordNext;
    }
This is the output:
l-s-s---s-l---s-s-s
-------s-l---l---l-s-s-s-s-l---l-l-s-s
s-s-s-s-l---l-l-s-s---s---s-s---l-s-l-s---s-s-s-s---s---l
---s---s-s---l-s-l-s---s-s-s-s---s---l-s-------l-s-l-l-s---s-l-l-s-l-s---l-s
 
     
    