From 51d955fbdada4400c8efd504d637b4ece6fcee22 Mon Sep 17 00:00:00 2001 From: Stoycho Kyosev Date: Wed, 12 Oct 2022 15:42:41 +0300 Subject: add seminar02 --- Seminar02/task01.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Seminar02/task01.cpp (limited to 'Seminar02/task01.cpp') diff --git a/Seminar02/task01.cpp b/Seminar02/task01.cpp new file mode 100644 index 0000000..3c98376 --- /dev/null +++ b/Seminar02/task01.cpp @@ -0,0 +1,28 @@ +#include +#include +#include + +std::string removeStars(const std::string& s) { + std::stack st; + + for(char c : s) { + if(c == '*') + st.pop(); + else + st.push(c); + } + + std::string res(st.size(), '\0'); + size_t idx = st.size() - 1; + + while(!st.empty()) { + res[idx--] = st.top(); + st.pop(); + } + + return res; +} + +int main() { + +} \ No newline at end of file -- cgit v1.3.1-23-gd82d