A. Alex and broken contest

Codeforces
IDCF877A
Time2000ms
Memory256MB
Difficulty
implementationstrings
English · Original
Chinese · Translation
Formal · Original
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.** ## Input The only line contains string from lowercase and uppercase letters and "___" symbols of length, not more than 100 — the name of the problem. ## Output Print "_YES_", if problem is from this contest, and "_NO_" otherwise. [samples]
一天,Alex 正在为他的朋友们创建一个竞赛,但不小心删除了它。幸运的是,所有题目都被保存了下来,但现在他需要在其他题目中找到它们。 但题目太多了,无法手动完成。Alex 请你写一个程序,通过题目的名称判断它是否来自这个竞赛。 已知,当且仅当题目的名称中恰好包含一个 Alex 的朋友的名字时,该题目才来自这个竞赛。他的朋友的名字是 "_Danil_"、"_Olya_"、"_Slava_"、"_Ann_" 和 "_Nikita_"。 *名字区分大小写。* 唯一的一行包含一个由小写字母、大写字母和 "___" 符号组成的字符串,长度不超过 #cf_span[100] —— 题目的名称。 如果题目来自这个竞赛,输出 "_YES_",否则输出 "_NO_"。 ## Input 唯一的一行包含一个由小写字母、大写字母和 "___" 符号组成的字符串,长度不超过 #cf_span[100] —— 题目的名称。 ## Output 如果题目来自这个竞赛,输出 "_YES_",否则输出 "_NO_"。 [samples]
**Definitions** Let $ S $ be the input string of length $ \leq 100 $, consisting of ASCII letters and underscores. Let $ F = \{ \text{"Danil"}, \text{"Olya"}, \text{"Slava"}, \text{"Ann"}, \text{"Nikita"} \} $ be the set of friend names (case-sensitive). **Constraints** - $ |S| \leq 100 $ - $ S $ contains only ASCII letters and `_` **Objective** Determine whether exactly one string $ f \in F $ occurs as a contiguous substring in $ S $, with no overlapping or multiple occurrences of any friend name. Formally, let $ c_f $ be the number of occurrences of $ f $ in $ S $ as a substring. Output "YES" if $ \sum_{f \in F} c_f = 1 $, otherwise output "NO".
Samples
Input #1
Alex_and_broken_contest
Output #1
NO
Input #2
NikitaAndString
Output #2
YES
Input #3
Danil_and_Olya
Output #3
NO
API Response (JSON)
{
  "problem": {
    "name": "A. Alex and broken contest",
    "description": {
      "content": "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 man",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF877A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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.\n\nBut there are too man...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "一天,Alex 正在为他的朋友们创建一个竞赛,但不小心删除了它。幸运的是,所有题目都被保存了下来,但现在他需要在其他题目中找到它们。\n\n但题目太多了,无法手动完成。Alex 请你写一个程序,通过题目的名称判断它是否来自这个竞赛。\n\n已知,当且仅当题目的名称中恰好包含一个 Alex 的朋友的名字时,该题目才来自这个竞赛。他的朋友的名字是 \"_Danil_\"、\"_Olya_\"、\"_Slava_\"、\"_...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ S $ be the input string of length $ \\leq 100 $, consisting of ASCII letters and underscores.  \nLet $ F = \\{ \\text{\"Danil\"}, \\text{\"Olya\"}, \\text{\"Slava\"}, \\text{\"Ann\"}, \\text{\"...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments