100% easy c++
\n# if you like this code please do upvote \nint n=s.length();\n\tvector frequency(26,0);``  // datatype = int\n        vector visited(26,false);  // data type 
\n# if you like this code please do upvote \nint n=s.length();\n\tvector<int> frequency(26,0);``  // datatype = int\n        vector<int> visited(26,false);  // data type = int \n       stack<char> st;   //    char datatype\n        \n       for(int i=0;i<n;i++)\n           frequency[s[i]-\'a\']++;\n        \n        for(auto a:s)\n        {\n            frequency[a-\'a\']--;\n            if(visited[a-\'a\']==true)  continue;\n            \n            while( !st.empty() && a< st.top()  && frequency[st.top()-\'a\']>0 ) // if top of stack is greater then current character\n            {\n               \n                visited[st.top()-\'a\']=false;\n                 st.pop();\n            }\n            \n            st.push(a);\n            visited[a-\'a\']=true;\n                \n        }\n        \n        string ans="";\n        while( !st.empty())\n        {\n            ans.push_back(st.top()) ;\n            st.pop();\n        }\n        \n      reverse(ans.begin() , ans.end()) ;\n        \n        return ans;
['Stack', 'C']