/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 324.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        string str;
        cin >> str;
        int character=0,lower_case=0,upper_case=0,digit=0,special=0;
        for(int i=0; i<str.length(); i++)
        {
            character++;
            if(str[i]>='a' && str[i]<='z')
                lower_case++;
            else if(str[i]>='A' && str[i]<='Z')
                upper_case++;
            else if(str[i]>='0' && str[i]<='9')
                digit++;
            else if(str[i]=='!' || str[i]=='@' || str[i]=='#' || str[i]=='$' || str[i]=='%' || str[i]=='^' || str[i]=='&' || str[i]=='*' || str[i]=='(' || str[i]==')')
                special++;
        }
        if(character>=8 && lower_case>0 && upper_case>0 && digit>0 && special>0)
            cout << "valid" << endl;
        else
            cout << "invalid" << endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1007 Password Checker
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-02 14:18:01
Judged At
2024-11-11 03:36:01
Judged By
Score
100
Total Time
2ms
Peak Memory
324.0 KiB