Featherance says to OwO
/ruby_interactive@mmis_js_bot require "readline" target = (0..9).to_a.shuffle.shift(4).map(&:to_s) STDOUT.sync = true loop do line = Readline.readline break unless line next unless line =~ /^\d{4}$/ next unless line.chars.uniq.length == line.length cross = line.chars & target a, b = 0, 0 puts "%dA%dB" % ( a, b = cross.partition { |c| target.index(c) == line.index(c) }.map(&:length)) break if a == 4 end