过样例WA
查看原帖
过样例WA
1266484
michaelwanghaoyu楼主2024/10/14 21:02
#include <iostream>
using namespace std;
string s;
int main()
{
    cin>>s;
    string t="";
    for(int i=0;i<s.length();i++)
	{
        if (s[i]!=',')
		{
            t += s[i];
        } 
		else 
		{
            bool pd=1;
            int xx=0,dx=0,sz=0,tsfh=0;
            for(int j=0;j<t.length();j++) 
			{
                if(t[j]>='a'&&t[j]<='z') 
				{
                    xx=1;
                } 
				else if(t[j]>='A'&&t[j]<='Z')
				{
                    dx=1;
                } 
				else if(t[j]>='0'&&t[j]<='9')
				{
                    sz=1;
                }
				else if (t[j]=='!'||t[j]=='@'||t[j]=='#'||t[j]=='$')
				{
                    tsfh=1;
                } 
				else 
				{
                    pd=0;
                    break;
                }
            }
            if(pd&&xx+dx+sz>=2&&tsfh>=1)
			{
                cout<<t<<endl;
            }
            t="";
        }
    }
    return 0;
}
2024/10/14 21:02
加载中...