Mr. Khalkhoul, an amazing teacher, likes to answer questions sent by his students via e-mail, but he often doesn't have the time to answer all of them. In this kata you will help him by making a program that finds
some of the answers.

You are given a `question` which is a string containing the question and some `information` which is a list of strings representing potential answers.

Your task is to find among `information` the UNIQUE string that has the highest number of words in common with `question`. We shall consider words to be separated by a single space.

You can assume that:

* all strings given contain at least one word and have no leading or trailing spaces,
* words are composed with alphanumeric characters only

You must also consider the case in which you get no matching words (again, ignoring the case): in such a case return `None/nil/null`.

Mr. Khalkhoul is countin' on you :)

Difficulty: EASY
Starter code: def answer(question, information):
	

Solutions:
def answer(question, information):
	(score, info) = max(((sum((word in info.lower().split() for word in question.lower().split())), info) for info in information))
	return None if not score else info


import re

def answer(question, information):
	pattern = re.compile('\\b({})\\b'.format('|'.join(set(question.lower().split()))), re.I)
	m = max(((len(pattern.findall(i)), i) for i in information))
	return m[1] if m[0] else None


def answer(question, informations):
	question_words = set(question.lower().split())
	compare = lambda information: len(question_words & set(information.lower().split()))
	return max([''] + informations, key=compare) or None


def answer(s, a):
	s = set(s.lower().split())
	a = [(x, set(x.lower().split())) for x in a]
	r = max(a, key=lambda x: len(x[1] & s))
	if r[1] & s:
		return r[0]


from functools import partial

def score(q, a):
	return len(q.intersection(a.lower().split()))

def answer(question, information):
	q = set(question.lower().split())
	a = max(information, key=partial(score, q))
	if score(q, a):
		return a


def answer(information, question):
	i = set(map(str.lower, information.split()))
	m = max([''] + question, key=lambda x: sum((x.lower() in i for x in x.split())))
	return m or None


def answer(question, information):
	words = set([w for w in question.lower().split()])
	r = sorted([(len(set([w for w in info.lower().split()]) & words), info) for info in information])[-1]
	return r[1] if r[0] else None


def answer(question, information):
	info = [i.split(' ') for i in information]
	ques = question.lower().split(' ')
	high = 0
	iHigh = -1
	for i in range(len(info)):
		score = 0
		for j in info[i]:
			if j.lower() in ques:
				score += 1
		if score > high:
			iHigh = i
			high = score
	if iHigh == -1:
		return None
	a = ''.join((j + ' ' for j in info[iHigh]))[:-1]
	return a


answer = lambda q, i: (lambda p=__import__('re').compile('\\b(%s)\\b' % '|'.join(set(q.lower().split())), __import__('re').I): (lambda m=max(((j, len(p.findall(j))) for j in i), key=lambda t: t[1]): m[0] if m[1] else None)())()


from collections import Counter

def answer(qs, info):
	(qs, option) = (Counter(qs.lower().split()), [])
	for i in info:
		c = sum((l == qs.get(k) for (k, l) in Counter(i.lower().split()).items()))
		option.append([c, i] if c else [0, None])
	return max(option)[1]