0分!
查看原帖
0分!
1017407
Wuenhao楼主2024/7/4 16:25
#include<iostream>
#include<cstring>
using namespace std;

const int N = 1e2 + 10;
string strs[N] = {};
int flg1 = 0,flg2 = 0,flg3 = 0;

int check(char ch)
{
	if(ch >= 'a' && ch <= 'z')
	{
		flg1 = 1;
		return 1;
	}
	
	if(ch >= 'A' && ch <= 'Z')
	{
		flg1 = 1;
		return 1;
	}
	
	if(ch >= '0' && ch <= '9')
	{
		flg2 = 1;
		return 1;
	}
	
	if(ch == '!' || ch == '@' || ch == '#' || ch == '$')  
	{
		flg3 = 1;
		return 1;
	}
	
	return 0;
}

int main()
{
	string str;
	int cnt = 0,flg = 0;
	cin >> str;
	
	for(int i = 0;i < str.size();i++)
	{
		if(str[i] == ',')
		{
			cnt++;
			continue;
		}
		
		strs[cnt] += str[i];
	}
	
	for(int i = 0;i < cnt;i++)
	{
		flg = 0;
		flg1 = 0,flg2 = 0,flg3 = 0;
		for(int j = 0;j < strs[i].size();j++)
		{
			if(check(strs[i][j]) == 0)
			{
				flg = 1;
				break;
			}
		}
		
		if(flg == 1)
		{
			continue;
		}
		
		if(strs[i].size() < 6 || strs[i].size() > 12)
		{
			continue; 
		}
		
		if(flg1 != 1 && flg2 != 1 && flg3 != 1)
		{
			continue;	
		}
		
		cout << strs[i] << endl;
	}
	
	cout << endl;
	return 0;
}
2024/7/4 16:25
加载中...