#K52082. Balanced Strings

    ID: 29230 Type: Default 1000ms 256MiB

Balanced Strings

Balanced Strings

Given a string s, a string is considered balanced if every character in the string appears the same number of times. For example, the string "aabbcc" is balanced because each character ('a', 'b', and 'c') appears exactly twice, whereas the string "aaabbc" is not balanced.

You are required to read multiple strings from standard input. The input terminates when a line containing a single asterisk (*) is encountered. For each string (except the termination line), output YES if the string is balanced and NO otherwise.

Note: An empty string is considered balanced.

inputFormat

The input consists of multiple lines. Each line contains a non-empty string (except possibly a line representing an empty string) with no spaces. The input terminates when a line containing a single asterisk (*) is encountered. This line should not be processed.

outputFormat

For each input string (excluding the termination line), output a single line containing YES if the string is balanced, otherwise output NO.

## sample
aabbcc
aaabbc
abcdab
aaaa
*
YES

NO NO YES

</p>