PROBLEM LINK
Author: Vikesh Tiwari
Tester : Vikesh Tiwari
Editorialist: Vikesh Tiwari
DIFFICULTY:
CakeWalk
PREREQUISITES:
implementation
PROBLEM
Given string as a password. Check if it satisfies following conditions.
- Length is at least 5 characters.
- At least one Large English letter.
- At least one small English letter.
- It should contain at least one digit.
If String Satifies all the Conditions, print “YES” else print “NO”.
EXPLANATION
Problem is Straight forward. Just correctly implement what was written in statement.
C++ Code:
#include<iostream>
#include<set>
using namespace std;
string s;
cin >> s;
bool upper = false, lower = false, digit = false;
for(int i= 0; i < s.size(); ++i){
if(isupper(s[i]))
upper = true;
if(islower(s[i]))
lower = true;
if(isdigit(s[i]))
digit = true;
}
puts((upper && lower && digit && s.size() >= 5) ? "YES" : "NO");
COMPLEXITY:
O(N)