You are given:
A string s
A group size k
A fill character fill
We divide the string into groups of size k, in order:
The first group uses the first k characters, the second group uses the next k, and so on.
If the final group has fewer than k characters, you must append the fill character until the group reaches size k.
After removing any added fill characters and concatenating the groups, we must get back the original string s.
Your task is to return an array of all the groups after applying this procedure.
Input: s = "abcdefghi", k = 3, fill = "x"
Output: ["abc","def","ghi"]
Explanation:
Every group naturally contains 3 characters, so no fill characters are needed.
Input: s = "abcdefghij", k = 3, fill = "x"
Output: ["abc","def","ghi","jxx"]
Explanation:
The last group contains "j" from the string and requires two 'x' fill characters to reach size 3.
Accepted:
Submission: