use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let mut s: Vec = itr.next().unwrap().chars().collect(); s.sort(); let mut changed = false; for i in 0..s.len() - 1 { if s[i] != s[i + 1] { if i + 1 == s.len() - 1 && s[i] == '0' { break; } s.swap(i, i + 1); changed = true; break; } } if changed { let s: String = s.into_iter().rev().collect(); println!("{}", s); } else { println!("-1"); } }