(个人水平有限,请见谅!)
题目描述:
输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。例如,输入”They are students.”和”aeiou”,则删除之后的第一个字符串变成”Thy r stdnts.”
输入描述:
每个测试输入包含2个字符串
输出描述:
输出删除后的字符串
输入:
They are students.
aeiou
输出:
Thy r stdnts.
代码示例:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str,del;
getline(cin,str);
getline(cin,del);
for (int i = 0; i < del.length(); i++)
for (int j = 0; j < str.length(); j++)
if (del[i] == str[j])
str.erase(j--,1);
cout << str;
}