0006デフォルトの名無しさん
2023/08/06(日) 19:07:03.27ID:Md+pNxjwconst FULL_BITS: u32 = (1 << 26) - 1;
fn main() {
let mut shortest: Option<String> = None;
for line in BufReader::new(io::stdin()).lines() {
let line = line.unwrap();
let mut bits = 0;
for b in line.as_bytes() {
let index = match b {
b'A'..=b'Z' => b - b'A',
b'a'..=b'z' => b - b'a',
_ => continue,
};
bits |= 1 << index;
}
if bits != FULL_BITS {
continue;
}
if let Some(ref shortest) = shortest {
if shortest.len() < line.len() {
continue;
}
}
shortest = Some(line);
}
if let Some(shortest) = shortest {
println!("{shortest}");
} else {
eprintln!("ERROR: no matched lines");
}
}