use std::io::{Read, stdin}; fn main() { let mut buf = String::new(); stdin().read_to_string(&mut buf).unwrap(); let mut tok = buf.split_whitespace(); let mut get = || tok.next().unwrap(); let mut x = get() .as_bytes() .iter() .cloned() .collect::>(); x.sort(); let find = x .iter() .enumerate() .find(|(_,s)| **s == x[0]); let ans = match find { None => "-1".to_string(), Some((i, _)) => { x.swap(0, i); x.reverse(); String::from_utf8(x).unwrap() } }; println!("{}", ans); }