#abc381b. B - 1122 String
B - 1122 String
当前没有测试数据。
Score : points
问题陈述
如果一个字符串 满足以下三个条件,则称其为 1122字符串:
- 是偶数。这里, 表示 的长度。
- 对于每个整数 ,满足 , 中的第 个和第 个字符是相同的。
- 中的每个字符恰好出现零次或两次。也就是说, 中包含的每个字符在 中恰好出现两次。
给定一个由小写英文字母组成的字符串 ,请打印 Yes
如果 是一个 1122 字符串,否则打印 No
。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
A string is called a 1122 string if and only if it satisfies all of the following three conditions:
- is even. Here, denotes the length of .
- For each integer satisfying , the -th and -th characters of are equal.
- Each character appears in exactly zero or two times. That is, every character contained in appears exactly twice in .
Given a string consisting of lowercase English letters, print Yes
if is a 1122 string, and No
otherwise.
Constraints
- is a string of length between and , inclusive, consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
If is a 1122 string, print Yes
; otherwise, print No
.
Sample Input 1
aabbcc
Sample Output 1
Yes
aabbcc
satisfies all the conditions for a 1122 string, so print Yes
.
Sample Input 2
aab
Sample Output 2
No
aab
has an odd length and does not satisfy the first condition, so print No
.
Sample Input 3
zzzzzz
Sample Output 3
No
zzzzzz
contains six z
s and does not satisfy the third condition, so print No
.