In this HackerRank String Split and Join problem we have given a string. Split the string on a " " (space) delimiter and join using a - hyphen.

HackerRank String Split and Join in python problem solution

HackerRank String Split and Join in python problem solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
print "-".join(raw_input().split(" "))

Second solution

string = input()
poop = string.split(" ")
temp =''
for i in poop:
    temp+= (i + '-')
print (temp[:-1])