
字符串
tunyalana
这个作者很懒,什么都没留下…
展开
-
前缀字符串(利用sort函数)
代码: #include<bits/stdc++.h> using namespace std; string s[121]; int main() { int n=0; while(true) { cin>>n; if(n==0) break; for(int i=0;i<n;++i) { cin>>s[i]; } sort(s,s+n); int sum=1; for(int i=1;i<n;++i) {..原创 2021-01-16 11:38:17 · 172 阅读 · 1 评论 -
删除子串(不区分大小写)(字符串匹配2)
题目更改: 假设子串不是gzu,而是人工输入,且仍然不区分大小写。 代码: #include<bits/stdc++.h> using namespace std; char s[121]; char t[121]; char t_xiaoxie[121]; char s_xiaoxie[121]; int flag_shuzu[121]={0}; int main() { cin>>s>>t; int flag=1,sum=0;//sum表示子串s在长串t中的出现.原创 2021-01-15 20:27:06 · 206 阅读 · 0 评论 -
统计子串在长串中出现的次数(字符串匹配1)
代码: #include<bits/stdc++.h> using namespace std; char s[121]; char t[121]; int main() { cin>>s>>t; int flag=1,sum=0;//sum表示子串s在长串t中的出现次数 for(int i=0;i<strlen(t);++i) { for(int j=0;j<strlen(s);++j) { if(s[j]!=t[i+j]) flag原创 2021-01-15 19:52:07 · 345 阅读 · 0 评论