reverse-string: Use a shorter example
For better clarity and signal-to-noise ratio.
Performed en-passant as a general cleanup while moving reverse-string to
the first core exercise.
pub fn reverse(input: &str) -> String {
- let mut output = String::with_capacity(input.len());
- output.extend(input.chars().rev());
- output
+ input.chars().rev().collect()
}
