We have a list of valid words, and a long string of text without whitespace. All characters are UTF8, a-z.
Please write a function that finds if the string can be composed of valid words, and if so, adds whitespace between them. Not all words have to be used, but words can be used multiple times. If it's not possible, return empty string and a descriptive error.
The words on validWords
do not overlap.
func addWhitespace(input string, validWords []string) (string, error)