aboutsummaryrefslogtreecommitdiff
path: root/remove_adjacent_dup_str.rs
diff options
context:
space:
mode:
Diffstat (limited to 'remove_adjacent_dup_str.rs')
-rw-r--r--remove_adjacent_dup_str.rs20
1 files changed, 0 insertions, 20 deletions
diff --git a/remove_adjacent_dup_str.rs b/remove_adjacent_dup_str.rs
deleted file mode 100644
index 063cfbb..0000000
--- a/remove_adjacent_dup_str.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-struct Solution;
-
-impl Solution {
- pub fn remove_duplicates(s: String) -> String {
- let mut ans = String::new();
- for c in s.chars() {
- if ans.len() > 0 && ans.chars().last() == Some(c) {
- ans.pop();
- } else {
- ans.push(c);
- }
- }
- ans
- }
-}
-
-fn main() {
- let s = "abbaca".to_string();
- print!("{}", Solution::remove_duplicates(s));
-}