#abc349b. B - Commencement

B - Commencement

Score: 200200 points

问题陈述

一个由小写英文字母组成的字符串 SS 如果满足以下所有整数 iiii 不小于 11)的属性,则称其为一个好字符串

  • SS 中恰好有正好零个或正好两个不同的字母出现恰好 ii 次。

给定一个字符串 SS,请确定它是否是一个好字符串。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

A string SS consisting of lowercase English letters is a good string if and only if it satisfies the following property for all integers ii not less than 11:

  • 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 given from Standard Input in the following format:

SS

Output

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

Sample Input 1

commencement

Sample Output 1

Yes

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.

Sample Input 2

banana

Sample Output 2

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.

Sample Input 3

ab

Sample Output 3

Yes