input: Write a function to build a dictionary from a list of string pairs where each pair is represented as "key->value". The function should take a list of such string pairs as input and return a dictionary with keys and values extracted from these pairs. If the list is empty, return an empty dictionary.
  assert build_dictionary(["apple->red", "banana->yellow", "cherry->red"])=={"apple":"red", "banana":"yellow", "cherry":"red"}
  assert build_dictionary(["dog->black", "cat->white"])=={"dog":"black", "cat":"white"}
  assert build_dictionary([])=={}
output: def build_dictionary(pairs):
      result = {}
      for pair in pairs:
          key, value = pair.split('->')
          result[key] = value
      return result