版权声明: https://blog.csdn.net/leelitian3/article/details/82705643
字符串模拟水题,只要合理的运用STL的函数即可
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
bool flag;
int n;
string a,b,alower,blower;
cin>>a>>flag>>n;
alower = a;
transform(a.begin(),a.end(),alower.begin(),::tolower);
while(n--)
{
cin>>b;
blower = b;
if(flag == 0)
{
transform(b.begin(),b.end(),blower.begin(),::tolower);
if(blower.find(alower) != string::npos) cout<<b<<endl;
}
else if(b.find(a) != string::npos) cout<<b<<endl;
}
return 0;
}