#[allow(dead_code)] pub mod nayuta { use std::{error::Error, str::FromStr}; use std::{io, result}; pub type Result = result::Result>; fn input_values() -> Result> where T: FromStr, ::Err: 'static + Error, { let s: String = input_string()?; let v: Vec = s .split_ascii_whitespace() .map(|x: &str| -> Result { x.parse::().map_err(|e| e.into()) }) .collect::>()?; Ok(v) } /// データを1行分、単一の文字列として読み込む /// /// 末尾の改行は取り除かれます。たぶん空白も pub fn input_string() -> Result { let mut s: String = String::new(); io::stdin().read_line(&mut s)?; Ok(s.trim().into()) } /// データを1行分、1つのデータとして読み込む pub fn input_single() -> Result where T: FromStr, ::Err: 'static + Error, { let s: String = input_string()?; Ok(s.parse::()?) } /// データを1行分、空白区切りの2要素として読み込む pub fn input_two_tuple() -> Result<(T, T)> where T: FromStr + Copy, ::Err: 'static + Error, { let v: Vec = input_values()?; Ok((v[0], v[1])) } } fn main() -> nayuta::Result<()> { let n: usize = nayuta::input_single()?; let s: String = nayuta::input_string()?; println!("{}", s[1..n - 1].to_owned()); Ok(()) }