mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
817 B
817 B
reverse_string
Instructions
Write a function rev_str
that takes a &str
as a parameter, and returns a string with its words reversed.
Expected Functions
pub fn rev_str(input: &str) -> String {
}
Usage
Here is a possible program to test your function :
use reverse_string::rev_str;
fn main() {
println!("{}", rev_str("Hello, world!"));
println!("{}", rev_str("Hello, my name is Roman"));
println!("{}", rev_str("I have a nice car!"));
println!("{}", rev_str("How old are You"));
println!("{}", rev_str("ex: this is an example água"));
}
And it's output:
student@ubuntu:~/[[ROOT]]/test$ cargo run
!dlrow ,olleH
namoR si eman ym ,olleH
!rac ecin a evah I
uoY era dlo woH
augá elpmaxe na si siht :xe
student@ubuntu:~/[[ROOT]]/test$