Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Fix the Input

The code below is supposed to read a name and print Hi, {name}!, but it has some bugs. Can you fix them?

Hints:

  • Make sure the string variable is mutable.
  • Don't forget to trim the input!
  • Check that read_line is called correctly.
rust
use std::io;

fn main() {
let input = String::new();
io::stdin().read_line(&input).unwrap();
println!("Hi, {}!", input);
}