Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
You are given a string. Split the string on a " "
(space) delimiter and join using a -
hyphen.
The first line contains a string consisting of space separated words.
Print the formatted string as explained above.
Sample Input
this is a string
Sample Output
this-is-a-string
String Split and Join - Hacker Rank Solution
Using the split and join methods, we can solve this challenge.
print '-'.join(raw_input().split())
def split_and_join(line): line = line.split(" ") line = "-".join(line) return line
def split_and_join(line): return line.replace(' ', '-')
print ("-".join(input().split()))
In our experience, we suggest you solve this String Split and Join Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
String Split and Join is available on Hacker Rank for Free, if you are stuck anywhere between compilation, just visit Queslers to get all Hacker Rank Solution
I hope this String Split and Join Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Hacker Rank Problem & Solutions >>
Mutations Hacker Rank Solution
What’s Your Name? Hacker Rank Solution
itertools.product() Hacker Rank Solution
String Validators Hacker Rank Solution
Text Alignment Hacker Rank solution