NVIDIA interview question

Coding question on string manipulation and stack