Make The String Great LeetCode solution in Rust

1
impl Solution {
2
pub fn make_good(s: String) -> String {
3
s.chars()
4
.fold(String::new(), |mut rez, c2| match (rez.pop(), c2) {
5
(None, c2) => c2.to_string(),
6
(Some(c1), c2) if c1 != c2 && c1.to_lowercase().eq(c2.to_lowercase()) => rez,
7
(Some(c1), c2) => rez + &c1.to_string() + &c2.to_string(),
8
})
9
}
10
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0