Amazon Interview Question

Reorganize a string into a specific pattern based on prompt.