summaryrefslogtreecommitdiff
path: root/reverse-words-in-a-string-iii/src/main.rs
blob: 473b428a7272a4e8a8b2afe1d767d3d4a60cdd32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
fn main() {
    println!("Hello, world!");
}

struct Solution;

impl Solution {
    pub fn reverse_words(mut s: String) -> String {
        unsafe {s.as_bytes_mut() }.split_mut(|&x| x == b' ').for_each(|x| x.reverse());
        s
    }
}