Amazon Interview Question

Leetcode string ques- using stack