input: from typing import List
  
  def shortest_substrings(arr: List[str]) -> List[str]:
      """
      You are given an array arr of size n consisting of non-empty strings.
  
      Find a string array answer of size n such that:
  
      answer[i] is the shortest substring of arr[i] that does not occur as a substring in any other string in arr. If multiple such substrings exist, answer[i] should be the lexicographically smallest. And if no such substring exists, answer[i] should be an empty string.
  
      Return the array answer.
  
      Examples:
      >>> arr = ["cab","ad","bad","c"]
      ["ab","","ba",""]
      >>> arr = ["abc","bcd","abcd"]
      ["","","abcd"]
  
      Constraints:
      n == arr.length
      2 <= n <= 100
      1 <= arr[i].length <= 20
      arr[i] consists only of lowercase English letters.
      """
  
output: 
      n = len(arr)
      answer = [""] * n
      
      for i in range(n):
          for length in range(1, len(arr[i]) + 1):
              found = False
              for start in range(len(arr[i]) - length + 1):
                  substring = arr[i][start:start + length]
                  valid = True
                  for j in range(n):
                      if i != j and substring in arr[j]:
                          valid = False
                          break
                  if valid:
                      answer[i] = substring
                      found = True
                      break
              if found:
                  break
      
      return answer
  