LinkedIn interview question

How to find the last substring with highest lexicographical