pub fn reverse_words(s: String) -> String {
s.split_whitespace()
.map(|word| word.chars().rev().collect::<String>())
.collect::<Vec<String>>()
.join(" ")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_reverse_words() {
assert_eq!(
reverse_words("Let's take LeetCode contest".to_string()),
"s'teL ekat edoCteeL tsetnoc".to_string()
);
}
}