-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path35.js
More file actions
30 lines (26 loc) · 745 Bytes
/
35.js
File metadata and controls
30 lines (26 loc) · 745 Bytes
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
// https://www.hackerrank.com/challenges/find-hackerrank/problem
function processData(input) {
let [n, ...s] = input.trim().split('\n')
s.forEach(i => {
let [, start='', end=''] = i.match(/(.)*hackerrank(.)*/) || []
console.log([[0, 1], [2, -1]][start.length][end.length])
})
}
process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
_input += input;
});
process.stdin.on("end", function () {
processData(_input);
});
/*
import re
for z in range(int(input())):
s=input()
if re.search(r'^hackerrank(.*hackerrank)?$',s): print(0)
elif re.search(r'^hackerrank',s): print(1)
elif re.search(r'hackerrank$',s): print(2)
else: print(-1)
*/