fn input(a: &[usize]) -> (usize, String) { for i in 0..10 { print!("{}", a[i]); } println!("",); let mut s: String = String::new(); std::io::stdin().read_line(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n = itr.next().unwrap().parse().unwrap(); let s = itr.next().unwrap().to_string(); (n, s) } fn main() { let mut ans = vec![9; 10]; let mut target = 0; let res = input(&ans); if res.1 == "unlocked" { return; } let mut same = res.0; loop { ans[target] -= 1; let (n, s) = input(&ans); if s == "unlocked" { break; } if n > same { same = n; target += 1; } else if n < same { ans[target] += 1; target += 1; } } }