words = []gets.to_i.times { words << gets }gets.to_i.times do word = gets result = false words.each { |x| result = true if word[x] } puts result ? 'YES' : 'NO'end
3 www woo jun 3 myungwoo hongjun dooho
YES YES NO
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!