Amazon interview question

String Manipulation, based on stack, where # is a backspace and we need to find resultant string.