use proconio::input; fn main () { input! { mut n: u128, } let mut ans: Vec = Vec::new(); while n > 1 { if n & 1 == 1 { n -= 1; n /= 2; ans.push('A'); } else { n -= 1; n /= 3; ans.push('B'); } } let s = ans.iter() .rev() .map(|&c| c.to_string()) .collect::(); println!("{}", s); }