1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() { println!("Hello, world!"); } pub fn next_greatest_letter(letters: Vec<char>, target: char) -> char { let mut smallest: char = '~'; let first = letters[0]; for c in letters { if c > target && c < smallest {smallest = c;} } if smallest == '~' { return first; } return smallest; }