求条求条,为什么50分,必关
查看原帖
求条求条,为什么50分,必关
1654544
YuJunDong楼主2025/6/14 14:03

求条,必关

#include <bits/stdc++.h>
using namespace std;
string str;
void alge(int s,int t){
	int len=t-s+1;
	if(len<6||len>12)return;
	for(int i=s;i<=t;i++){
		char ch=str[i];
		if((!isalnum(ch))&&ch!='@'&&ch!='!'&&ch!='#'&&ch!='$'){
			return;
		}
	}
	for(int i=s;i<=t;i++){
		cout<<str[i];
	}
	cout<<endl;
	return;
}
int main(){
	cin>>str;
	str=str+",";
	int i=0;
	while(1){
		int j=i+1;
		while(str[j++]!=','){}
		j-=2;
		alge(i,j);
		if(j+2>=str.length()-1){
			break;
		}
		i=j+2;
	}
    return 0;
}

方法感觉与其他人不同~~ ,所以也有不同的错误方式~~ 。

2025/6/14 14:03
加载中...