update max substring