HackerRank- Python String Split and Join



Given a string. Split the string on a " " (space) delimiter and join using a - hyphen.



  1. def split_and_join(line):
  2. a=line.split(" ")
  3. result="-".join(a)
  4. return result
  5. if __name__ == '__main__':
  6. line = input()
  7. result = split_and_join(line)
  8. print(result)

download android app