Compass Interview Question

find the matching words from string