C/C++中怎样删除字符串中与另一个字符串中相同的字符

日期:2016-01-13 16:07:59 人气:1

C/C++中怎样删除字符串中与另一个字符串中相同的字符

#include #include #include using namespace std; int main() { string str1, str2; cin >> str1 >> str2; size_t index = 0; while((index = str1.find(str2)) != string::npos) { str1.erase(index, str2.size()); } cou
    A+
热门评论