
단어 S와 정수 i가 주어졌을 때, S의 i번째 글자를 출력하는 프로그램을 작성하시오.
첫째 줄에 영어 소문자와 대문자로만 이루어진 단어 S가 주어진다. 단어의 길이는 최대 1000이다.
둘째 줄에 정수 i가 주어진다. (1≤i≤|S|)
S의 i번째 글자를 출력한다.
use std::io;
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let mut index = String::new();
io::stdin().read_line(&mut index).unwrap();
let index: usize = index.trim().parse().unwrap();
let chars: Vec<char> = input.trim().chars().collect();
println!("{}", chars[index-1]);
}
특이사항 없음