Skip to content

Instantly share code, notes, and snippets.

@kngwyu
Created July 3, 2016 12:55
Show Gist options
  • Save kngwyu/aa5bb5b2b2f6db93f82d52be16785084 to your computer and use it in GitHub Desktop.
Save kngwyu/aa5bb5b2b2f6db93f82d52be16785084 to your computer and use it in GitHub Desktop.
fn main() {
let a = next_line();
let b = getint() - 1;
let it = b as usize;
let c = a.as_bytes()[it] as char;
println!("{}\n", c);
}
fn next_line() -> String {
let mut input = String::new();
std::io::stdin().read_line(&mut input).unwrap();
input
}
fn getint() -> i32 {
let res = next_line();
let res = res.trim().parse().unwrap();
res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment