B. [Atc349B] Commencement

    传统题 1000ms 256MiB

[Atc349B] Commencement

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Statement

A string SS consisting of lowercase English letters is considered a good string if and only if it satisfies the following property for all integers i1i \geq 1:

  • There are exactly zero or exactly two different letters that appear exactly ii times in SS.

Given a string SS, determine if it is a good string.

Constraints

  • SS is a string of lowercase English letters with a length between 11 and 100100, inclusive.

Input

The input is provided in the following format:

S

Output

Print Yes if SS is a good string, and No otherwise.

Example

commencement
Yes

Explanation

For the string "commencement", the number of different letters that appear exactly ii times is as follows:

  • i=1i=1: two letters ("o"and"t")
  • i=2i=2: two letters ("c"and"n")
  • i=3i=3: two letters ("e"and"m")
  • i4i \geq 4: zero letters
  • Therefore,commencement satisfies the condition of a good string.
banana
No

For the string banana, there is only one letter that appears exactly one time, which is b, so it does not satisfy the condition of a good string.

ab
Yes

Programming exercise on 14 August

未参加
状态
已结束
规则
XCPC
题目
3
开始于
2024-8-14 16:30
结束于
2024-8-14 18:30
持续时间
2 小时
主持人
参赛人数
2