Heywood interview question

Finding common prefixes to words in a List in Java.