给定一个字符串s
和一个正整数N
,逐渐将每个字符逐渐重复,直到N
重复为止,然后停留在N
重复位置,直到N
字符远离结尾,然后再次下移。
例如,给定abalone
和3
:
a we start with 1 copy
bb then 2 copies
aaa then 3 copies, which is our second parameter
lll so we continue using 3 copies
ooo until we reach the end
nn where we use 2 copies
e and then finally 1 copy
结果将是abbaaalllooonne
。
保证字符串的长度大于2N
并且仅包含字符从a
到z
。
更多测试用例:
N string output
2 aaaaa aaaaaaaa
3 abcdabcdabcd abbcccdddaaabbbcccdddaaabbbccd