#K55632. Rearrange Promotional Code

    ID: 30019 Type: Default 1000ms 256MiB

Rearrange Promotional Code

Rearrange Promotional Code

You are given a promotional code represented as a string s consisting of lowercase English letters. Your task is to determine whether it is possible to rearrange the letters of the string such that no two adjacent characters are the same.

It can be mathematically shown that a rearrangement exists if and only if the frequency of the most common character, denoted as \(\max\_freq\), satisfies the inequality:

[ \max_freq \le \left\lceil \frac{n}{2} \right\rceil ]

Here, \(n\) is the length of the string. If this condition holds, output YES; otherwise, output NO.

inputFormat

The input consists of a single line containing the string s which represents the promotional code. The string will contain only lowercase English letters.

outputFormat

Output a single line: YES if it is possible to rearrange the string such that no two adjacent characters are the same, otherwise NO.

## sample
aabb
YES