Question
Bit Blitz
Kiran holds a binary string T. In one step, he can select any even-length consecutive substring that is all 0s or all 1s and remove it. After any number of such steps, determine if it’s possible to reduce the string to empty.
Input
The first line of the input contains a string T.
Constraints
1 ≤ Length(T) ≤ 105
T is a binary string. It consists only of 0's or 1's
Constraints
1 ≤ Length(T) ≤ 105
T is a binary string. It consists only of 0's or 1's
Output
Print (without quotes) "YES", if you can get an empty string, else print "NO".
Example
Sample Input
1001
Sample Output
YES
Explaination
First we remove the substring "00" from the string. It becomes "11".
Now, we remove "11" and the string becomes empty.
1001
Sample Output
YES
Explaination
First we remove the substring "00" from the string. It becomes "11".
Now, we remove "11" and the string becomes empty.