We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Python
  3. Strings
  4. String Split and Join
  5. Discussions

String Split and Join

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 823 Discussions, By:

recency

Please Login in order to post a comment

  • KLU_2100080103
    1 hour ago+ 0 comments

    may this code helps u def split_and_join(line): l=line.split() s="" for i in l: s=s+i+"-" s=s.strip("-") return s

    0|
    Permalink
  • KLU_2100080103
    1 hour ago+ 0 comments

    may this code helps u def split_and_join(line): l=line.split() s="" for i in l: s=s+i+"-" s=s.strip("-") return s

    0|
    Permalink
  • KLU_2100080103
    1 hour ago+ 0 comments

    may this code helps u def split_and_join(line): l=line.split() s="" for i in l: s=s+i+"-" s=s.strip("-") return s

    0|
    Permalink
  • KLU_2100080103
    1 hour ago+ 0 comments

    may this code helps u def split_and_join(line): l=line.split() s="" for i in l: s=s+i+"-" s=s.strip("-") return s

    0|
    Permalink
  • emin_f_mammadov
    3 days ago+ 0 comments
    def split_and_join(line):
        # write your code here
        return "-".join(line.strip() for line in line.split())
    if __name__ == '__main__':
        line = input()
        result = split_and_join(line)
        print(result)
    
    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy