cloud_drop @ 2024-11-04 13:15:09
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
int xiao=0,da=0,shu=0,fu=0,p=0,k=0;
cin>>s;
for(int i=0;i<100;i++){
if(s[i]>='a'&&s[i]<='z')
xiao++;
else if(s[i]>='A'&&s[i]<='z')
da++;
else if(s[i]>='0'&&s[i]<='9')
shu++;
else if(s[i]=='!'||s[i]=='@'||s[i]=='#'||s[i]=='$')
fu++;
else if(s[i]==','){
if(xiao+da+shu+fu>=6&&xiao+da+shu+fu<=12&&k!=1){
if((xiao>0&&da>0)||(xiao>0&&fu>0)||(da>0||fu>0)){
for(p=i-xiao-da-fu-shu;p<i;p++){
cout<<s[p];
}
cout<<endl;
xiao=0,shu=0,da=0,fu=0,k=0;
}
else xiao=0,shu=0,da=0,fu=0;
}
else xiao=0,shu=0,da=0,fu=0;
}
else k=1;
}
return 0;
}
求调
by Unstoppablexiaotiao @ 2024-11-12 13:42:57
@cloud_drop 你的for循环条件错了,应该是i<s.size()