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.
davhojt
fe2f708d89
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
reverse_string
Instructions
Create a function named rev_str
that takes a &str
as a parameter, and returns a String
with its letters reversed.
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 its output:
$ cargo run
!dlrow ,olleH
namoR si eman ym ,olleH
!rac ecin a evah I
uoY era dlo woH
augá elpmaxe na si siht :xe
$