Divide by Zero 2018 and Codeforces Round 474 (Div. 1 + Div. 2, combined)
A
Check the string
Codeforces
1200
原题
←B →
翻译中…

A has a string consisting of some number of lowercase English letters 'a'. He gives it to his friend B who appends some number of letters 'b' to the end of this string. Since both A and B like the characters 'a' and 'b', they have made sure that at this point, at least one 'a' and one 'b' exist in the string.

翻译中…

B now gives this string to C and he appends some number of letters 'c' to the end of the string. However, since C is a good friend of A and B, the number of letters 'c' he appends is equal to the number of 'a' or to the number of 'b' in the string. It is also possible that the number of letters 'c' equals both to the number of letters 'a' and to the number of letters 'b' at the same time.

翻译中…

You have a string in your hands, and you want to check if it is possible to obtain the string in this way or not. If it is possible to obtain the string, print "YES", otherwise print "NO" (without the quotes).

翻译中…

Input

翻译中…

The first and only line consists of a string $S$ ($ 1 \le |S| \le 5\,000 $). It is guaranteed that the string will only consist of the lowercase English letters 'a', 'b', 'c'.

翻译中…

Output

翻译中…

Print "YES" or "NO", according to the condition.

翻译中…

Note

翻译中…

Consider first example: the number of 'c' is equal to the number of 'a'.

翻译中…

Consider second example: although the number of 'c' is equal to the number of the 'b', the order is not correct.

翻译中…

Consider third example: the number of 'c' is equal to the number of 'b'.

翻译中…

样例

Input #1
aaabccc
Output #1
YES
InputCopy OutputCopy
Input #2
bbacc
Output #2
NO
InputCopy OutputCopy
Input #3
aabc
Output #3
YES
InputCopy OutputCopy
题目信息
题号
960A
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。