use proconio::input; fn main() { input! { s: String, } let mut ans = String::new(); let mut c = 0; c = s.chars().filter(|&c| c == 'C').count() as i32; if c == 0 { c = s.chars().filter(|&c| c == 'P').count() as i32; for _ in 0..c { ans += "P"; } c = s.chars().filter(|&c| c == 'T').count() as i32; for _ in 0..c { ans += "T"; } } else { c = s.chars().filter(|&c| c == 'T').count() as i32; for _ in 0..c { ans += "T"; } c = s.chars().filter(|&c| c == 'C').count() as i32; for _ in 0..c { ans += "C"; } c = s.chars().filter(|&c| c == 'P').count() as i32; for _ in 0..c { ans += "P"; } } println!("{}", ans); }