fn solve(_reader: R, _writer: &mut W) { let mut _scanner = Scanner::new(_reader); #[allow(unused_macros)] macro_rules! scan { ($T:ty) => { _scanner.next::<$T>().unwrap() }; ($($T:ty),+) => { ($(scan!($T)),+) }; ($T:ty; $n:expr $(; $m:expr)*) => {{ let mut vec = Vec::with_capacity($n); for _ in 0..$n { vec.push(scan!($T $(; $m)*)); } vec }}; } #[allow(unused_macros)] macro_rules! scan_iter { ($T:ty; $n:expr) => { _scanner.take::<$T>($n).map(|x| x.unwrap()) }; } #[allow(unused_macros)] macro_rules! print { ($fmt:expr) => { write!(_writer, $fmt).unwrap() }; ($fmt:expr, $($arg:tt)*) => { write!(_writer, $fmt, $($arg)*).unwrap() }; } #[allow(unused_macros)] macro_rules! println { ($fmt:expr) => { writeln!(_writer, $fmt).unwrap() }; ($fmt:expr, $($arg:tt)*) => { writeln!(_writer, $fmt, $($arg)*).unwrap() }; } #[allow(unused_macros)] macro_rules! eprint { ($fmt:expr) => { #[cfg(debug_assertions)] write!(::std::io::stderr(), $fmt).unwrap() }; ($fmt:expr, $($arg:tt)*) => { #[cfg(debug_assertions)] write!(::std::io::stderr(), $fmt, $($arg)*).unwrap() }; } #[allow(unused_macros)] macro_rules! eprintln { ($fmt:expr) => { #[cfg(debug_assertions)] writeln!(::std::io::stderr(), $fmt).unwrap() }; ($fmt:expr, $($arg:tt)*) => { #[cfg(debug_assertions)] writeln!(::std::io::stderr(), $fmt, $($arg)*).unwrap() }; } #[allow(unused_macros)] macro_rules! dump { ($($x:expr),+) => { eprint!("[{}:{}] ", file!(), line!()); eprintln!(concat!($(stringify!($x), " = {:?}; "),+), $($x),+); }; } use misc::ByteString; let mut s = scan!(ByteString); s.0.sort(); let mut t = s.clone(); t.0.dedup(); let ans = if s == t { "YES" } else { "NO" }; println!("{}", ans); } const STACK_SIZE_MEBIBYTES: Option = None; fn main() { fn run_solver() { let stdin = stdin(); let stdout = stdout(); #[cfg(debug_assertions)] let mut writer = stdout.lock(); #[cfg(not(debug_assertions))] let mut writer = ::std::io::BufWriter::new(stdout.lock()); solve(stdin.lock(), &mut writer); writer.flush().unwrap(); } if let Some(size) = STACK_SIZE_MEBIBYTES { let builder = thread::Builder::new().name("solve".to_string()).stack_size(size * 1024 * 1024); builder.spawn(run_solver).unwrap().join().unwrap(); } else { run_solver(); } } use io::Scanner; use std::io::{stdin, stdout, BufRead, Write}; use std::thread; pub mod misc { pub use self::byte_char::*; pub use self::byte_string::*; mod byte_char { use std::fmt::{self, Debug, Display, Formatter}; #[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct ByteChar(pub u8); impl Debug for ByteChar { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "b\'{}\'", self.0 as char) } } impl Display for ByteChar { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "{}", self.0 as char) } } } mod byte_string { use misc::ByteChar; use std::fmt::{self, Debug, Display, Formatter}; #[derive(Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct ByteString(pub Vec); impl Debug for ByteString { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "b\"")?; for &c in &self.0 { write!(f, "{}", c.0 as char)?; } write!(f, "b\"") } } impl Display for ByteString { fn fmt(&self, f: &mut Formatter) -> fmt::Result { for &c in &self.0 { write!(f, "{}", c)?; } Ok(()) } } } } pub mod io { pub use self::from_bytes::FromBytes; pub use self::scanner::Scanner; mod from_bytes { use misc::{ByteChar, ByteString}; use std::str::{self, FromStr}; #[derive(Debug)] pub struct FromBytesError; pub trait FromBytes: Sized { type Err; fn from_bytes(bytes: &[u8]) -> Result; } impl FromBytes for ByteChar { type Err = FromBytesError; fn from_bytes(bytes: &[u8]) -> Result { if bytes.len() == 1 { Ok(ByteChar(*unsafe { bytes.get_unchecked(0) })) } else { Err(FromBytesError) } } } impl FromBytes for ByteString { type Err = FromBytesError; fn from_bytes(bytes: &[u8]) -> Result { Ok(ByteString(bytes.iter().cloned().map(ByteChar).collect())) } } impl FromBytes for T { type Err = T::Err; fn from_bytes(bytes: &[u8]) -> Result { let s = if cfg!(debug_assertions) { str::from_utf8(bytes).unwrap() } else { unsafe { str::from_utf8_unchecked(bytes) } }; T::from_str(s) } } } mod scanner { use io::FromBytes; use std::io::BufRead; use std::marker::PhantomData; pub struct Scanner { reader: R, buffer: Vec, position: usize, } impl Scanner { pub fn new(reader: R) -> Self { Scanner { reader: reader, buffer: vec![], position: 0, } } pub fn next(&mut self) -> Result { FromBytes::from_bytes(self.next_bytes().unwrap_or(&[])) } pub fn take(&mut self, n: usize) -> Take { Take { scanner: self, n: n, _marker: PhantomData, } } pub fn next_bytes(&mut self) -> Option<&[u8]> { if self.buffer.is_empty() { self.read_line(); } loop { match self.buffer.get(self.position) { Some(&b' ') => self.position += 1, Some(&b'\n') => self.read_line(), Some(_) => break, None => return None, } } let start = self.position; loop { match self.buffer.get(self.position) { Some(&b' ') | Some(&b'\n') | None => break, Some(_) => self.position += 1, } } Some(&self.buffer[start..self.position]) } fn read_line(&mut self) { self.position = 0; self.buffer.clear(); self.reader.read_until(b'\n', &mut self.buffer).unwrap(); } } pub struct Take<'a, R: 'a, T> { scanner: &'a mut Scanner, n: usize, _marker: PhantomData T>, } impl<'a, R: BufRead, T: FromBytes> Iterator for Take<'a, R, T> { type Item = Result; fn next(&mut self) -> Option { if self.n > 0 { self.n -= 1; Some(self.scanner.next()) } else { None } } fn size_hint(&self) -> (usize, Option) { (self.n, Some(self.n)) } } impl<'a, R: BufRead, T: FromBytes> ExactSizeIterator for Take<'a, R, T> {} } }