exercise for checking whether a string 'sentence' can be constructed by an array or words