Problem
Given a string word and a natural number n, write a function solution that returns the result of repeating the string word exactly n times.
Constraints
wordconsists only of lowercase English letters.- The length of
wordis between 1 and 100 inclusive. nis a natural number between 1 and 10 inclusive.
Test Case
| Test Case Number | word | n | return |
|---|---|---|---|
| 1 | "abc" | 3 | "abcabcabc" |
| 2 | "hello" | 2 | "hellohello" |
| 3 | "a" | 5 | "aaaaa" |
Explanation for Test Case 1
- When
word = "abc"andn = 3, the result of repeating"abc"3 times is"abcabcabc".
Explanation for Test Case 2
- When
word = "hello"andn = 2, the result of repeating"hello"2 times is"hellohello".
Explanation for Test Case 3
- When
word = "a"andn = 5, the result of repeating"a"5 times is"aaaaa".