# your code goes here
import re

string = "A B C D"
keys = ["A", "B", "A B"]

matches = []
for k in keys:
    matches += re.findall(re.escape(k), string)
    
print(matches)
