From ba5f0cbd9468e4c0d126c4ab199844576e0121df Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Thu, 10 Feb 2022 05:34:07 +0100 Subject: Impwuvd piping behaviour --- main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 4afe084..da09e17 100644 --- a/main.cpp +++ b/main.cpp @@ -29,7 +29,6 @@ bool IsLetter(const char c) { return (lowercase_c >= 'a') && (lowercase_c <= 'z'); } - //! Checks whether or not `c` is an uppercase character bool IsUpper(const char c) { if (!IsLetter(c)) @@ -339,9 +338,13 @@ int main(int argc, char** argv) { // Else, be prepared to get __piped__ else { + // We're better off processing all in one go, as to not re-seed the PRNG for every single line... std::string buf; + std::stringstream ss; while (std::getline(std::cin, buf)) - std::cout << MakeUwu(buf) << std::endl; + ss << buf << std::endl; + + std::cout << MakeUwu(ss.str()) << std::endl; } return 0; -- cgit v1.2.3