use vectors in longest_substr