#C6654. Binary String Removal

    ID: 50438 Type: Default 1000ms 256MiB

Binary String Removal

Binary String Removal

You are given a binary string S of length n. In this problem, you are allowed to remove a contiguous substring consisting entirely of '1's from the string.

Your task is to determine whether it is possible to completely remove all characters from the string using the allowed operation.

It turns out that a necessary and sufficient condition for the complete removal is that the string does not contain the pattern $$1\;0\;1$$ (i.e. a '0' immediately between two '1's). If the string contains this pattern, then no sequence of removals can result in an empty string.

Output YES if it is possible to remove all characters, otherwise output NO.

inputFormat

The input is given via standard input with two lines:

  1. The first line contains a single integer n representing the length of the binary string.
  2. The second line contains the binary string S of length n.

outputFormat

Output a single line with either YES or NO indicating whether it is possible to remove all characters from the string using the allowed operation.

## sample
6
111000
YES

</p>