input: Write a function to find the longest substring without repeating characters.
  assert longest_substring("abcabcbb") == "abc"
  assert longest_substring("bbbbb") == "b"
  assert longest_substring("pwwkew") == "wke"
output: def longest_substring(s: str) -> str:
      start = 0
      max_length = 0
      max_substring = ""
      char_index_map = {}
      
      for end in range(len(s)):
          if s[end] in char_index_map and char_index_map[s[end]] >= start:
              start = char_index_map[s[end]] + 1
          char_index_map[s[end]] = end
          
          if end - start + 1 > max_length:
              max_length = end - start + 1
              max_substring = s[start:end + 1]
      
      return max_substring