Skip to content

Commit 7ec469e

Browse files
committed
Create 2390-removing-stars-from-a-string.rs
1 parent 3b72648 commit 7ec469e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

2390-removing-stars-from-a-string.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pub fn remove_stars(s: String) -> String {
2+
let mut ret = String::new();
3+
for c in s.chars().collect::<Vec<char>>() {
4+
if c == '*' { ret.pop(); } else { ret.push(c); }
5+
}
6+
ret
7+
}
8+
9+
fn main() {
10+
println!("{:?}", remove_stars("leet**cod*e".to_string()));
11+
}

0 commit comments

Comments
 (0)