# your code goes here
a = 'this day is a beautiful day'
b = 'this day is awful'
x = [x for x in b.split() if x in a.split()]
for i in range(len(x)):
for j in range(i, len(x)+1):
word = ' '.join(x[i:j])
if word in a:
print(word)
IyB5b3VyIGNvZGUgZ29lcyBoZXJlCgphID0gJ3RoaXMgZGF5IGlzIGEgYmVhdXRpZnVsIGRheScKYiA9ICd0aGlzIGRheSBpcyBhd2Z1bCcKCnggPSBbeCBmb3IgeCBpbiBiLnNwbGl0KCkgaWYgeCBpbiBhLnNwbGl0KCldCgpmb3IgaSBpbiByYW5nZShsZW4oeCkpOgogICAgZm9yIGogaW4gcmFuZ2UoaSwgbGVuKHgpKzEpOgogICAgICAgIHdvcmQgPSAnICcuam9pbih4W2k6al0pCiAgICAgICAgaWYgd29yZCBpbiBhOgogICAgICAgICAgICBwcmludCh3b3JkKQ==