D - 1122 String Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 150

問題文

文字列 T が以下の 3 つの条件をすべてみたすとき、かつそのときに限り、T1122 文字列 と呼びます。

  • \lvert T \rvert は偶数である。ここで、\lvert T \rvertT の長さを表す。
  • 1\leq i\leq \frac{\lvert T \rvert}{2} をみたす整数 i について、T(2i-1) 文字目と 2i 文字目は等しい。
  • 各文字は T にちょうど 0 個または 2 個現れる。すなわち、T に含まれる文字は T にちょうど 2 回ずつ登場する。

英小文字のみからなる文字列 S が与えられるので、S が 1122 文字列であるならば Yes を、そうでないならば No を出力してください。

制約

  • S は英小文字のみからなる長さ 1 以上 100 以下の文字列

入力

入力は以下の形式で標準入力から与えられる。

S

出力

S が 1122 文字列ならば Yes を、そうでないならば No を出力せよ。


入力例 1

aabbcc

出力例 1

Yes

S=aabbcc は 1122 文字列の条件をすべてみたしているため、Yes を出力します。


入力例 2

aab

出力例 2

No

S=aab は長さが奇数であり、 1 つめの条件をみたしていないため、No を出力します。


入力例 3

zzzzzz

出力例 3

No

S=zzzzzzz6 個含まれており、 3 つめの条件をみたしていないため、No を出力します。

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.