Determine dictionary-based string segmentation | Microsoft Interview Question