题目:
提交:
while(line = readline()) {
if (line.length <= 8) {
console.log('NG')
continue
}
let hasNoRepeat = true
for(let i = 0; i <= line.length - 3; i++) {
if(line.slice(i + 1).indexOf(line.slice(i, i + 3)) >= 0) {
hasNoRepeat = false
}
}
if (!hasNoRepeat) {
console.log('NG')
continue
}
let lowcase = 0
let upcase = 0
let number = 0
let other = 0
if (/[a-z]+/.test(line)) {
lowcase = 1
}
if (/[A-Z]+/.test(line)) {
upcase = 1
}
if (/[0-9]+/.test(line)) {
number = 1
}
if (/[^a-zA-Z0-9]+/.test(line)) {
other = 1
}
let hasEnoughTypes = lowcase + upcase + number + other >= 3
if (!hasEnoughTypes) {
console.log('NG')
continue
}
console.log('OK')
}