Submission #1589192


Source Code Expand

fn main() {
  let x: char = read();
  println!("{}", x as u32 - 'A' as u32 + 1);
}

fn read() -> char {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().parse().ok().unwrap()
}

Submission Info

Submission Time
Task A - A
User aimy
Language Rust (1.15.1)
Score 0
Code Size 227 Byte
Status CE

Compile Error

error[E0277]: the trait bound `char: std::str::FromStr` is not satisfied
 --> ./Main.rs:9:14
  |
9 |   buf.trim().parse().ok().unwrap()
  |              ^^^^^ the trait `std::str::FromStr` is not implemented for `char`

error: aborting due to previous error