Amazon interview question

Leetcode string ques- using stack