题目
题解
字符串。
类似题目太多了,不想多说了,最后挂上字符串处理的题目。
代码
#include<bits/stdc++.h>
using namespace std;
int ans, n;
string s, str;
int main()
{
cin>>str>>n;
while(n--) {
cin>>s;
char ss[10];
strcpy(ss, s.c_str());
sort(ss, ss+8);
do {
for(int i = 0;i < 8;i ++)
s[i] = ss[i];
if(str.find(s) != -1) ans ++;
} while(next_permutation(ss, ss+8));
}
cout << ans;
return 0;
}