input: Write a function to find the longest non-repeating substring.
  assert longest_non_repeating_substring("abcabcbb") == "abc"
  assert longest_non_repeating_substring("bbbbb") == "b"
  assert longest_non_repeating_substring("pwwkew") == "wke"
  assert longest_non_repeating_substring("abcdefg") == "abcdefg"
  assert longest_non_repeating_substring("abcddefg") == "abcd"
output: def longest_non_repeating_substring(s):
      start = 0
      max_len = 0
      max_substr = ""
      used_chars = {}
      
      for i, char in enumerate(s):
          if char in used_chars and used_chars[char] >= start:
              start = used_chars[char] + 1
          used_chars[char] = i
          current_len = i - start + 1
          if current_len > max_len:
              max_len = current_len
              max_substr = s[start:i+1]
      
      return max_substr