def _strip_input_and_targets(example):
  """Strip inputs and targets in example dict."""
  example['input'] = example['input'].strip()
  target = example['target']
  if isinstance(target, str):
    example['target'] = target.strip()
  else:
    example['target'] = [x.strip() for x in target]

  return example