Rust sliding window (only code)
Code
# Code
```rust []
impl Solution {
    pub fn shortest_beautiful_substring(s: String, k: i32) -> String {
        let sent: &str = &"1".repeat(101);
        let sc = s.chars().collect::<Vec<_>>();
        let mut prev_smallest = sent;
        for l in 0..sc.len() {
            if sc[l] == '0' {
                continue;
            }
            let mut cnt = 1;
            let mut r = l + 1;
            while r < s.len() && cnt < k {
                cnt += (sc[r] == '1') as i32;
                r += 1;
            }
            if cnt < k {
                continue;
            }
            prev_smallest = smallest(prev_smallest, &s[l..r]);
        }
        if prev_smallest == sent {
            return "".to_string();
        }
        prev_smallest.to_string()
    }
}
fn smallest<'a>(s1: &'a str, s2: &'a str) -> &'a str {
    if s1.len() < s2.len() {
        s1
    } else if s2.len() < s1.len() {
        s2
    } else {
        s1.min(s2)
    }
}
```
['String', 'Sliding Window', 'String Matching', 'Rust']