summary refs log tree commit diff stats
path: root/lingo.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-12-09 18:38:56 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2022-12-09 18:38:56 -0500
commitcf8d349f603dad115c7df2c44df49595a0a164e7 (patch)
tree1707bbc2d576fc4b4d2f3ce65b6d8a96e41deeb8 /lingo.cpp
parentbe86554f2325427bb9421aa7274d135becab443c (diff)
downloadlingo-cf8d349f603dad115c7df2c44df49595a0a164e7.tar.gz
lingo-cf8d349f603dad115c7df2c44df49595a0a164e7.tar.bz2
lingo-cf8d349f603dad115c7df2c44df49595a0a164e7.zip
Solution lengths are split up by spaces
Diffstat (limited to 'lingo.cpp')
-rw-r--r--lingo.cpp9
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;