CS Problem of writing a word find given a set of input