Length of last word, merge intervals, permutation seq