input: Write a function to build a dictionary from a list of strings where each string contains a word and its corresponding color, separated by "->". The function should return the constructed dictionary.
  assert build_dictionary(["apple->red", "banana->yellow", "cherry->red"])=={'apple': 'red', 'banana': 'yellow', 'cherry': 'red'}
  assert build_dictionary(["dog->brown", "cat->white", "rabbit->gray"])=={'dog': 'brown', 'cat': 'white', 'rabbit': 'gray'}
  assert build_dictionary([])=={}
  assert build_dictionary(["apple->red", "banana->yellow", "apple->green"])=={'apple': 'green', 'banana': 'yellow'}
output: def build_dictionary(strings):
      result = {}
      for s in strings:
          word, color = s.split("->")
          result[word] = color
      return result