-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathStrong Password
More file actions
88 lines (56 loc) · 1.26 KB
/
Copy pathStrong Password
File metadata and controls
88 lines (56 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//Code in C language
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int islower(int c);
int isupper(int c);
int isdigit(int c);
int main() {
int n;
scanf("%d", &n);
char password[100];
scanf("%s", password);
int arr[4];
int q=0;
for( int i=0; i<n; i++)
{
if ( islower(password[i]))
{
arr[1] = 1;
}
if(isupper(password[i]))
{
arr[2] = 1;
}
if(isdigit(password[i]))
{
arr[0] = 1;
}
if ( password[i] == '!' || password[i] == '@' || password[i] == '#' || password[i] == '$' || password[i] == '^' || password[i] == '&' || password[i] == '*' || password[i] == '(' || password[i] == ')' || password[i] == '-' || password[i] == '+' )
{
arr[3] =1;
}
}
for ( int i =0; i < 4; i++)
{
if ( arr[i] != 1)
{
q++;
}
}
if ( n+q >=6)
{
printf("%d",q);
}
else
{
int z = 6 - (n+q);
q = q+z;
printf("%d",q);
}
return 0;
}