[Atc349B] Commencement
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Problem Statement
A string consisting of lowercase English letters is considered a good string if and only if it satisfies the following property for all integers :
- There are exactly zero or exactly two different letters that appear exactly times in .
Given a string , determine if it is a good string.
Constraints
- is a string of lowercase English letters with a length between and , inclusive.
Input
The input is provided in the following format:
S
Output
Print Yes if is a good string, and No otherwise.
Example
commencement
Yes
Explanation
For the string "commencement", the number of different letters that appear exactly times is as follows:
- : two letters ("o"and"t")
- : two letters ("c"and"n")
- : two letters ("e"and"m")
- : zero letters
- Therefore,
commencementsatisfies 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