Skip to content

Commit 12cc86e

Browse files
Create Strong Password.cpp
1 parent 9800a88 commit 12cc86e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: Hackerrank/Strong Password.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
int n, a, b, c, d;
5+
int main() {
6+
7+
string s;
8+
cin >> n >> s;
9+
for (int i = 0; i < n; i++) {
10+
if (s[i] >= '0' && s[i] <= '9') a = 1;
11+
else if (s[i] >= 'a' && s[i] <= 'z') b = 1;
12+
else if (s[i] >= 'A' && s[i] <= 'Z') c = 1;
13+
else d = 1;
14+
}
15+
cout << max(6 - n, 4 - a - b - c - d);
16+
return 0;
17+
}

0 commit comments

Comments
 (0)