Skip to content

1910. Remove All Occurrences of a Substring #466

@fkdl0048

Description

@fkdl0048
class Solution {
public:
    string removeOccurrences(string s, string part) {
        size_t pos;
        
        while ((pos = s.find(part)) != string::npos) {
            std::cout << pos;
            s.erase(pos, part.length());
        }

        return s;        
    }
};

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions