input: Write a function to build a dictionary from string to string of the given samples. Each sample is a string formatted as "key->value". If a key appears more than once, the value corresponding to the latest appearance of that key should be used in the dictionary. The function should accept a list of these samples and return a dictionary.
  assert build_dictionary(["apple->red", "banana->yellow", "cherry->red"]) == {'apple': 'red', 'banana': 'yellow', 'cherry': 'red'}
  assert build_dictionary(["cat->meow", "dog->bark", "cat->purr"]) == {'cat': 'purr', 'dog': 'bark'}
  assert build_dictionary([]) == {}
output: def build_dictionary(samples):
      result = {}
      for sample in samples:
          key, value = sample.split('->')
          result[key] = value
      return result