#C1524. Beautiful String Rearrangement
Beautiful String Rearrangement
Beautiful String Rearrangement
Given a string s consisting of lowercase English letters, determine whether it is possible to rearrange the letters so that no two adjacent characters are the same, i.e. the string becomes beautiful.
The rearrangement is possible if and only if the frequency M of the most frequent character satisfies the inequality: $M \le \lceil \frac{N}{2} \rceil$, where N is the length of the string.
Print "YES" if such a rearrangement is possible, and "NO" otherwise.
inputFormat
The input consists of a single line containing a string s ($1 \leq |s| \leq 10^5$) of lowercase English letters.
outputFormat
Output a single line: "YES" if the string can be rearranged to form a beautiful string, otherwise "NO".
## sampleaabbcc
YES
</p>