forked from rahul22mrk/hackoctoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckyourPassword.js
49 lines (47 loc) · 1.16 KB
/
CheckyourPassword.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
function runProgram(input) {
// Write code here
var input = input.trim().split("\n");
for (let i = 2; i < input.length; i += 2) {
var str = input[i].trim()
// console.log(str)
let count = 0
for (let j = 0; j < str.length; j++) {
if (str[j] < 10 && str[j] >= 0) {
count++
}
}
// console.log(count)
if (count < str.length / 2 && count > 0) {
console.log("Strong")
}
else {
console.log("Weak")
}
}
}
if (process.env.USERNAME === "ranus") {
runProgram(`2
6
aa1234
6
abcd12
4
pjfj`);
} else {
process.stdin.resume();
process.stdin.setEncoding("ascii");
let read = "";
process.stdin.on("data", function (input) {
read += input;
});
process.stdin.on("end", function () {
read = read.replace(/\n$/, "");
read = read.replace(/\n$/, "");
runProgram(read);
});
process.on("SIGINT", function () {
read = read.replace(/\n$/, "");
runProgram(read);
process.exit(0);
});
}