fn main() { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); let mut n: Vec = buf.trim() .chars() .map(|n| n.to_string()) .collect(); for i in 0..n.len() { let mut max_idx = i; for j in i+1..n.len() { if n[max_idx] < n[j] { max_idx = j; } } if max_idx != i { n.swap(i, max_idx); break; } } println!("{}", n.concat()); }