-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
74 lines (59 loc) · 1.12 KB
/
main.js
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
console.log("Start");
/* password: A-TO-Z */
/**letters 'B', 'R', 'O', 'K', 'E' and 'N' */
/** INT 1 <= T <= 1000 and 1 <= N <= 100 */
/** OUT "Secure"
"No Secure" */
var password = ["PASSWORDSECURE", "BLUEWORKING", "SECUREWORD"];
var checkS = function (params) {
checkValue = true;
var CharBro = {
B: 0,
R: 0,
O: 0,
K: 0,
E: 0,
N: 0,
};
for (const key in params) {
switch (params[key]) {
case "B":
CharBro.B++;
break;
case "R":
CharBro.R++;
break;
case "O":
CharBro.O++;
break;
case "K":
CharBro.K++;
break;
case "E":
CharBro.E++;
break;
case "N":
CharBro.N++;
break;
default:
break;
}
}
if (
(CharBro.B == CharBro.R) |
(CharBro.R == CharBro.O) |
(CharBro.O == CharBro.K) |
(CharBro.K == CharBro.E) |
(CharBro.E == CharBro.N)
) {
checkValue = false;
}
return checkValue;
};
password.forEach((element) => {
if (checkS(element)) {
console.log("Secure");
} else {
console.log("No Secure");
}
});