From cf8d349f603dad115c7df2c44df49595a0a164e7 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 9 Dec 2022 18:38:56 -0500 Subject: Solution lengths are split up by spaces --- lingo.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lingo.cpp') diff --git a/lingo.cpp b/lingo.cpp index 5f8a025..38c6483 100644 --- a/lingo.cpp +++ b/lingo.cpp @@ -450,13 +450,14 @@ private: msg_stream << NONE_EMOTE << std::endl; } } - std::string spaceless = solution.getText(); - while (spaceless.find(" ") != std::string::npos) + auto byspace = hatkirby::split>(solution.getText(), " "); + std::list lens; + for (const std::string& wordpart : byspace) { - spaceless.erase(spaceless.find(" "), 1); + lens.push_back(std::to_string(wordpart.size())); } - msg_stream << "(" << spaceless.size() << ")"; + msg_stream << "(" << hatkirby::implode(std::begin(lens), std::end(lens), " ") << ")"; std::string message_text = msg_stream.str(); std::cout << message_text << std::endl << std::endl << solution.getText() << std::endl; -- cgit 1.4.1