| 14 | size_t max_word_length(const Words& words); |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | Words words; |
| 19 | std::string text; // The string to be sorted |
| 20 | const auto separators{" ,.!?\"\n"}; // Word delimiters |
| 21 | |
| 22 | // Read the string to be processed from the keyboard |
| 23 | std::cout << "Enter a string terminated by *:" << std::endl; |
| 24 | getline(std::cin, text, '*'); |
| 25 | |
| 26 | extract_words(words, text, separators); |
| 27 | if (words.empty()) |
| 28 | { |
| 29 | std::cout << "No words in text." << std::endl; |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | sort(words); // Sort the words |
| 34 | show_words(words); // Output the words |
| 35 | } |
| 36 | |
| 37 | void extract_words(Words& words, const std::string& text, const std::string& separators) |
| 38 | { |
nothing calls this directly
no test coverage detected