Status Compilation error
One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems were saved, but now he needs to find them among other problems. But there are too many problems, to do it manually. Alex asks you to write a program, which will determine if a problem is from this contest by its name. It is known, that problem is from this contest if and only if its name contains one of Alex's friends' name exactly once. His friends' names are "Danil", "Olya", "Slava", "Ann" and "Nikita". Names are case sensitive. The only line contains string from lowercase and uppercase letters and "_" symbols of length, not more than 100 — the name of the problem. Print "YES", if problem is from this contest, and "NO" otherwise.
Oднажды Алекс создавал конкурс о своих друзьях, но случайно удалил его. К счастью, все проблемы были спасены, но теперь ему нужно найти их среди других проблем.
Но слишком много проблем, чтобы делать это вручную. Алекс просит вас написать программу, которая по названию определит, является ли проблема из этого конкурса.
Известно, что проблема в этом конкурсе тогда и только тогда, когда в его названии ровно один раз встречается имя одного из друзей Алекса . Его друзей зовут « Данил », « Оля », « Слава », « Анна » и « Никита ».
Имена чувствительны к регистру.
В единственной строке находится строка из строчных и прописных букв и символов « _ » длиной не более 100 - название задачи.
Выведите « YES », если задача из этого конкурса, и « NO » в противном случае.
let txt = 'NikitaAndString'
if (txt.indexOf('_') > -1) {
console.log("No");
} else {
console.log('Yes')
}
Это задание было на Олимпиаде, я скорее всего не понял его(Выходило "Compilation error". Можно ли его решить по-другому или правильно.