Python 3-liner solution


#1
class Solution:
	# @param A : string
	# @param B : list of strings
	# @return a list of integers
	def solve(self, A, B):
	    good_words = set(A.split('_'))
	    sorted_list = [(sum([int(word in good_words) for word in review.split('_')]), i) for i, review in enumerate(B)]
	    return [val[1] for val in sorted(sorted_list, key=lambda val: -val[0])]