Input:
- A string (the wave-snippet) with a length
>= 2
. - A positive integer n
>= 1
.
Output:
We output a single-line wave. We do this by repeating the input string n times.
Challenge rules:
- If the first and last character of the input string matches, we only output it once in the total output (i.e.
^_^
of length 2 becomes^_^_^
and not^_^^_^
). - The input string won't contain any whitespaces/tabs/new-lines/etc.
- If your language doesn't support non-ASCII characters, then that's fine. As long as it still complies to the challenge with ASCII-only wave-input.
General rules:
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language. - Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code.
- Also, please add an explanation if necessary.
Test cases:
_.~"( length 12
_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(
'°º¤o,¸¸,o¤º°' length 3
'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'
-__ length 1
-__
-__ length 8
-__-__-__-__-__-__-__-__
-__- length 8
-__-__-__-__-__-__-__-__-
¯`·.¸¸.·´¯ length 24
¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯
** length 6
*******
String & length of your own choice (be creative!)
>= 1
" seems kinda pleonastic to me... :) \$\endgroup\$