Solve leetcode's longest substring without repeating characters problem.