10105: ABC349 —— B - Commencement
[Creator : ]
Description
A string $S$ consisting of lowercase English letters is a good string if and only if it satisfies the following property for all integers $i$ not less than $1$:
- There are exactly zero or exactly two different letters that appear exactly $i$ times in $S$.
Given a string $S$, determine if it is a good string.
- There are exactly zero or exactly two different letters that appear exactly $i$ times in $S$.
Given a string $S$, determine if it is a good string.
Input
The input is given from Standard Input in the following format:
```
$S$
```
```
$S$
```
Output
Print `Yes` if $S$ is a good string, and `No` otherwise.
Constraints
- $S$ is a string of lowercase English letters with a length between $1$ and $100$, inclusive.
Sample 1 Input
commencement
Sample 1 Output
Yes
For the string commencement, the number of different letters that appear exactly i times is as follows:
- i=1: two letters (o and t)
- i=2: two letters (c and n)
- i=3: two letters (e and m)
- i≥4: zero letters
Therefore, commencement satisfies the condition of a good string.
Sample 2 Input
banana
Sample 2 Output
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 3 Input
ab
Sample 3 Output
Yes