Refactor 'longest substring without repeating characters'.