103811: [Atcoder]ABC381 B - 1122 String

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:23 Solved:0

Description

Score : $150$ points

Problem Statement

A string $T$ is called a 1122 string if and only if it satisfies all of the following three conditions:

  • $\lvert T \rvert$ is even. Here, $\lvert T \rvert$ denotes the length of $T$.
  • For each integer $i$ satisfying $1\leq i\leq \frac{|T|}{2}$, the $(2i-1)$-th and $2i$-th characters of $T$ are equal.
  • Each character appears in $T$ exactly zero or two times. That is, every character contained in $T$ appears exactly twice in $T$.

Given a string $S$ consisting of lowercase English letters, print Yes if $S$ is a 1122 string, and No otherwise.

Constraints

  • $S$ is a string of length between $1$ and $100$, inclusive, consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

$S$

Output

If $S$ is a 1122 string, print Yes; otherwise, print No.


Sample Input 1

aabbcc

Sample Output 1

Yes

$S=$aabbcc satisfies all the conditions for a 1122 string, so print Yes.


Sample Input 2

aab

Sample Output 2

No

$S=$aab has an odd length and does not satisfy the first condition, so print No.


Sample Input 3

zzzzzz

Sample Output 3

No

$S=$zzzzzz contains six zs and does not satisfy the third condition, so print No.


Output

得分:150分

问题陈述

如果一个字符串$T$满足以下三个条件,则称其为1122字符串

  • $\lvert T \rvert$是偶数。这里,$\lvert T \rvert$表示$T$的长度。
  • 对于每个满足$1\leq i\leq \frac{|T|}{2}$的整数$i$,$T$的第$(2i-1)$个和第$2i$个字符相等。
  • 每个字符在$T$中恰好出现零次或两次。即,$T$中包含的每个字符恰好出现两次。

给定一个由小写英文字母组成的字符串$S$,如果$S$是1122字符串,则打印Yes,否则打印No

约束条件

  • $S$是由长度在$1$到$100$之间(包括$1$和$100$)的小写英文字母组成的字符串。

输入

输入从标准输入以下格式给出:

$S$

输出

如果$S$是1122字符串,则打印Yes;否则,打印No


示例输入1

aabbcc

示例输出1

Yes

$S=$aabbcc满足1122字符串的所有条件,所以打印Yes


示例输入2

aab

示例输出2

No

$S=$aab的长度是奇数,不满足第一个条件,所以打印No


示例输入3

zzzzzz

示例输出3

No

$S=$zzzzzz包含六个z,不满足第三个条件,所以打印No


加入题单

上一题 下一题 算法标签: