Website Summary Files Commits Branches @commit @diff @stats
path: root / Seminar02 / task01.cpp
diff options
context:
space:
mode:
Commit51d955fbdada4400c8efd504d637b4ece6fcee22 (patch)
Author
 Stoycho Kyosev <stoycho.kk@gmail.com>
2022-10-12 15:42:41 +0300
Committer
 Stoycho Kyosev <stoycho.kk@gmail.com>
2022-10-12 15:42:41 +0300
Filese029d2772c32e4cce968faf6940f1b5bde46f0cc /Seminar02/task01.cpp
Data-structures-and-algorithms-51d955fbdada4400c8efd504d637b4ece6fcee22.tar
Data-structures-and-algorithms-51d955fbdada4400c8efd504d637b4ece6fcee22.tar.gz
Data-structures-and-algorithms-51d955fbdada4400c8efd504d637b4ece6fcee22.zip
Parentfd8930b9c939f3b234b7fe661f329004a931b79c (diff)
add seminar02
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