spoj DICT: search proper prefix of words from dictionary