Skip to content

Commit a445281

Browse files
created strong password problem
1 parent ef7360d commit a445281

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

StrongPassword/strongpasswordqn.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Louise joined a social networking site to stay in touch with her friends. The signup page required her to input a name and a password. However, the password must be strong. The website considers a password to be strong if it satisfies the following criteria:
2+
3+
Its length is at least 6.
4+
It contains at least one digit.
5+
It contains at least one lowercase English character.
6+
It contains at least one uppercase English character.
7+
It contains at least one special character. The special characters are: !@#$%^&*()-+
8+
She typed a random string of length n in the password field but wasn't sure if it was strong. Given the string she typed, can you find the minimum number of characters she must add to make her password strong?
9+
10+
Note: Here's the set of types of characters in a form you can paste in your solution:
11+
12+
numbers = "0123456789"
13+
lower_case = "abcdefghijklmnopqrstuvwxyz"
14+
upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
15+
special_characters = "!@#$%^&*()-+"
16+
Input Format
17+
18+
The first line contains an integer n denoting the length of the string.
19+
20+
The second line contains a string consisting of n characters, the password typed by Louise. Each character is either a lowercase/uppercase English alphabet, a digit, or a special character.
21+
22+
Constraints
23+
1 <= n <= 100
24+
25+
Output Format
26+
27+
Print a single line containing a single integer denoting the answer to the problem.
28+
29+
Sample Input 0
30+
31+
3
32+
Ab1
33+
Sample Output 0
34+
35+
3
36+
Explanation 0
37+
38+
She can make the password strong by adding characters, for example, $hk, turning the password into Ab1$hk which is strong.
39+
40+
2 characters aren't enough since the length must be at least 6.
41+
42+
Sample Input 1
43+
44+
11
45+
#HackerRank
46+
Sample Output 1
47+
48+
1
49+
Explanation 1
50+
51+
The password isn't strong, but she can make it strong by adding a single digit

0 commit comments

Comments
 (0)