Given a string and a non-negative integer $n$, output a new string in which each character is repeated $n$ times.
Test cases:
"abc", 1 -> "abc" "Hello", 0 -> "" "double", 2 -> "ddoouubbllee" "Hi", 4 -> "HHHHiiii" "", 20 -> ""
This post advertises a product without disclosing the author's affiliation or without it being relevant to the topic (spam).
This post violates the Code of Conduct, as a reasonable person would find it inappropriate.
This community is part of the Codidact network. We have other communities too — take a look!
You can also join us in chat!
Want to advertise this community? Use our templates!
Like what we're doing? Support us! Donate
0 comment threads