-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3559425
Showing
10 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
use std::io; | ||
|
||
fn main() { | ||
// Declare a mutable string variable to store user input | ||
let mut input_string = String::new(); | ||
|
||
println!("Enter a string: "); | ||
|
||
// Read the user input from the standard input | ||
io::stdin() | ||
.read_line(&mut input_string) | ||
.expect("Failed to read input"); | ||
|
||
// Trim whitespace (e.g., the trailing newline) from the input | ||
let input_string = input_string.trim(); | ||
|
||
// Reverse the string using Rust's built-in string manipulation | ||
let reversed_string = input_string.chars().rev().collect::<String>(); | ||
|
||
println!("Reversed string: {}", reversed_string); | ||
} |
Empty file.
Empty file.
Empty file.