input: Write a function to generate a nested dictionary from keys and values.
  assert generate_dict(['a', 'b', 'c', 'd'], [1, 2, 3, 4]) == {'a': {'b': {'c': {'d': 4}}}}
  assert generate_dict(['x', 'y'], [10, 20]) == {'x': {'y': 20}}
  assert generate_dict(['k1', 'k2', 'k3'], [5, 15, 25]) == {'k1': {'k2': {'k3': 25}}}
  assert generate_dict(['single'], [100]) == {'single': 100}
  assert generate_dict(['a', 'b'], [1]) == None
output: def generate_dict(keys, values):
      if len(keys) != len(values):
          return None
      nested_dict = values[-1]
      for key in reversed(keys[:-1]):
          nested_dict = {key: nested_dict}
      return nested_dict