You are viewing a single comment's thread. Return to all comments →
words = line.split() new_str = '' for l in words: new_str += l if not(l == words[-1]): new_str+='-' return new_str
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
String Split and Join
You are viewing a single comment's thread. Return to all comments →
words = line.split() new_str = '' for l in words: new_str += l if not(l == words[-1]): new_str+='-' return new_str