Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <algorithm>
- using namespace std;
- class LargestSubsequence {
- public:
- string getLargest(string s) {
- string res;
- for (auto base = s.begin(); base != s.end(); ++base) {
- auto it = max_element(base, s.end());
- res += *it;
- base = it;
- }
- return res;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement