Website Summary Files Commits Branches @commit @diff @stats
path: root / Seminar02 / task01.cpp
diff options
context:
space:
mode:
1 files changed, 28 insertions, 0 deletions
-rw-r--r--Seminar02/task01.cpp28
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<string>
+#include<stack>
+#include<iostream>
+
+std::string removeStars(const std::string& s) {
+ std::stack<char> 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