From 3fee6e25380a5570c87f076a80bff6e922041aee Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Thu, 14 Dec 2023 19:37:50 +0900 Subject: [PATCH] Minor fix to `get_next_word(...)` --- src/main.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cc b/src/main.cc index f01f282..08db272 100644 --- a/src/main.cc +++ b/src/main.cc @@ -16,7 +16,11 @@ std::string get_next_word(std::istream *i) { if (in != std::char_traits::eof() && in != ' ' && in != '\n' && in != '\r') { word.push_back((char)in); } else if (in == ' '|| in == '\n' || in == '\r' || in == '\t') { - break; + if (word.empty()) { + break; + } else { + continue; + } } }