From f491e2fc254a65b9b76f5f9b71edf1b98849c386 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 9 May 2022 19:27:08 +0800 Subject: [PATCH] =?UTF-8?q?16.=20=E6=9B=BF=E6=8D=A2=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/14064166/ --- AcWing/16/16.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 AcWing/16/16.cpp diff --git a/AcWing/16/16.cpp b/AcWing/16/16.cpp new file mode 100644 index 00000000..52ed2f08 --- /dev/null +++ b/AcWing/16/16.cpp @@ -0,0 +1,12 @@ +class Solution { + public: + string replaceSpaces(string &str) { + string res; + for (auto c : str) + if (c == ' ') + res += "%20"; + else + res += c; + return res; + } +};