in contests/agc022/agc022_a.rs [17:44]
fn solve(src: &str) -> String {
let source = AutoSource::from(src);
input! {
from source,
S: String
}
let S: String = S;
let mut words: HashSet<u8> = HashSet::new();
let start_char = "a".as_bytes()[0];
let end_char = "z".as_bytes()[0];
for c in start_char..end_char {
words.insert(c);
}
if S == "zyxwvutsrqponmlkjihgfedcba" {
return format!("-1");
}
for s in S.chars() {
words.remove(&s.to_string().as_bytes()[0]);
}
let sorted_words = words.into_iter().collect::<Vec<_>>();
format!("{}{}", S, sorted_words[0].to_string())
}