Implement the longest sub sequence.