Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use stack. For every character to be appended, decide how many character(s) from the stack needs to get popped based on the stack length and the count of the required character.
Pop the extra characters out from the stack and return the characters in the stack (reversed).