{"author_name":"aloealoe","description":"stack\u3067\u8caf\u3081\u3066\u3044\u304d\u3001stack\u306etop\u3068\u540c\u3058\u6587\u5b57\u304c\u304d\u305f\u3089\u3001pop\u3059\u308b\u3002 '''cpp class Solution { public: string removeDuplicates(string s) { stackst; for(char i:s) { if(st.size() == 0) { st.push(i); } else if(i == st.top()) { st.pop(); } else { st.push(i); } } string ans; while(st.size() != 0) { ans += st.top(); st.pop(); } reverse(a\u2026","height":"190","image_url":null,"provider_url":"https://hatena.blog","type":"rich","author_url":"https://blog.hatena.ne.jp/aloealoe/","published":"2021-09-13 22:30:00","blog_title":"\u65e5\u3005\u52c9\u5f37\u3059\u308b blog","width":"100%","title":"1047. Remove All Adjacent Duplicates In String","blog_url":"https://aloealoe.hatenablog.com/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Faloealoe.hatenablog.com%2Fentry%2F2021%2F09%2F13%2F223000\" title=\"1047. Remove All Adjacent Duplicates In String - \u65e5\u3005\u52c9\u5f37\u3059\u308b blog\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","version":"1.0","url":"https://aloealoe.hatenablog.com/entry/2021/09/13/223000","provider_name":"Hatena Blog","categories":["c++","Leetcode"]}