Word w and integer n are provided. Output w repeated n times, joined with '-' (dash). If n is 0 output empty.
• First line: String w (single word, no spaces)
• Second line: Integer n
• Print the word w repeated n times, joined with -
• If n = 0, print nothing (empty output)
• 0 ≤ n ≤ 10^5
• 1 ≤ length of w ≤ 10^5
Input:
w = "hello"
n = 3
Repeat word 3 times and join with -
Result:
hello-hello-hello
If n = 0, output is empty.
1.Read string w.
2.Read integer n.
3.If n == 0, print nothing.
4.Otherwise:
• Create a list containing w repeated n times.
• Join the list using '-'.join().
5.Print the result.