rewrite leetcode longest substring without repeating characters