The Longest substring in ascending order and compute the average