fn main() { let mut ans=vec![0;10]; let mut flag=0; for i in 0..10{ let mut maxj=-1; let mut indj=-1; for j in 0..10{ ans[i]=j; println!( "{}", ans.iter() .map(std::string::ToString::to_string) .collect::>() .join("") ); let (x, y): (i32, String) = { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), ) }; if x==10{ flag=1; break; } if x>maxj{ maxj=x; indj=j; } } if flag==1{ break; } ans[i]=indj; } }