diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-09 18:38:56 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-09 18:38:56 -0500 |
commit | cf8d349f603dad115c7df2c44df49595a0a164e7 (patch) | |
tree | 1707bbc2d576fc4b4d2f3ce65b6d8a96e41deeb8 | |
parent | be86554f2325427bb9421aa7274d135becab443c (diff) | |
download | lingo-cf8d349f603dad115c7df2c44df49595a0a164e7.tar.gz lingo-cf8d349f603dad115c7df2c44df49595a0a164e7.tar.bz2 lingo-cf8d349f603dad115c7df2c44df49595a0a164e7.zip |
Solution lengths are split up by spaces
-rw-r--r-- | lingo.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lingo.cpp b/lingo.cpp index 5f8a025..38c6483 100644 --- a/lingo.cpp +++ b/lingo.cpp | |||
@@ -450,13 +450,14 @@ private: | |||
450 | msg_stream << NONE_EMOTE << std::endl; | 450 | msg_stream << NONE_EMOTE << std::endl; |
451 | } | 451 | } |
452 | } | 452 | } |
453 | std::string spaceless = solution.getText(); | 453 | auto byspace = hatkirby::split<std::list<std::string>>(solution.getText(), " "); |
454 | while (spaceless.find(" ") != std::string::npos) | 454 | std::list<std::string> lens; |
455 | for (const std::string& wordpart : byspace) | ||
455 | { | 456 | { |
456 | spaceless.erase(spaceless.find(" "), 1); | 457 | lens.push_back(std::to_string(wordpart.size())); |
457 | } | 458 | } |
458 | 459 | ||
459 | msg_stream << "(" << spaceless.size() << ")"; | 460 | msg_stream << "(" << hatkirby::implode(std::begin(lens), std::end(lens), " ") << ")"; |
460 | 461 | ||
461 | std::string message_text = msg_stream.str(); | 462 | std::string message_text = msg_stream.str(); |
462 | std::cout << message_text << std::endl << std::endl << solution.getText() << std::endl; | 463 | std::cout << message_text << std::endl << std::endl << solution.getText() << std::endl; |