use std::io; use std::str; fn main() { let mut scan = UnsafeScanner::new(io::stdin().lock()); let n = scan.token::(); let s = scan.token::(); let mut freq = [0i32; 26]; for c in s.chars() { let char_idx = (c as u8 - b'A') as usize; freq[char_idx] += 1; } for val in freq { if val > 1 { println!("Yes"); return; } } println!("No"); } // I/O template below pub struct UnsafeScanner { reader: R, buf_str: Vec, buf_iter: str::SplitAsciiWhitespace<'static>, } impl UnsafeScanner { pub fn new(reader: R) -> Self { Self { reader, buf_str: vec![], buf_iter: "".split_ascii_whitespace(), } } pub fn token(&mut self) -> T { loop { if let Some(token) = self.buf_iter.next() { return token.parse().ok().expect("Failed parse"); } self.buf_str.clear(); self.reader .read_until(b'\n', &mut self.buf_str) .expect("Failed read"); self.buf_iter = unsafe { let slice = str::from_utf8_unchecked(&self.buf_str); std::mem::transmute(slice.split_ascii_whitespace()) } } } }