ja_son @ 2024-08-24 21:41:06
rt
#include<bits/stdc++.h>
using namespace std;
string n,a;
int numbers,bwords,swords,fu;
int main(){
cin>>n;
int lens=0;
for(int i=0;i<n.size();i++){
if(n[i]==','){
if(lens>=6 && lens<=12){
if((swords>0 && bwords>0) || (numbers>0 && bwords>0) || (swords>0 && numbers>0) && fu>0){
cout<<a<<endl;
lens=0;
}
}
swords=0,bwords=0,numbers=0,fu=0;
a="";
i++;
}
if(n[i]>='a' && n[i]<='z'){
swords++;
}
else if(n[i]>='A' && n[i]<='Z'){
bwords++;
}
else if(n[i]>='0' && n[i]<='9'){
numbers++;
}
else if(n[i]>='!' || n[i]<='@' || n[i]>='$' || n[i]>='#'){
fu++;
}
lens++;
a+=n[i];
}
return 0;
}
by ja_son @ 2024-08-25 09:42:10
更新一下 求调
#include<bits/stdc++.h>
using namespace std;
string n,a;
int numbers,bwords,swords,fu;
int main(){
cin>>n;
bool tf=true;
int lens=0;
for(int i=0;i<n.size();i++){
if(n[i]==','){
if(tf){
if(lens>=6 && lens<=12){
if((swords>0 && bwords>0) || (numbers>0 && bwords>0) || (swords>0 && numbers>0) && fu>0){
cout<<a<<endl;
lens=0;
}
}
}
tf=true;
swords=0,bwords=0,numbers=0,fu=0;
a="";
i++;
}
if(tf){
if(n[i]>='a' && n[i]<='z'){
swords++;
}
else if(n[i]>='A' && n[i]<='Z'){
bwords++;
}
else if(n[i]>='0' && n[i]<='9'){
numbers++;
}
else if(n[i]=='!' || n[i]=='@' || n[i]=='$' || n[i]=='#'){
fu++;
}
else{
tf=false;
}
}
lens++;
a+=n[i];
}
return 0;
}
by ja_son @ 2024-08-25 09:53:39
终于AC了 55555555
所以 此贴结束
-------------------------封楼线------------------------------