|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||24||20||18||81.818%|
A mysterious circular arrangement of black stones and white stones has appeared. Ming has been tasked with balancing the stones so that only one black and one white stone remain.
Ming has two operations for balancing the stones:
Given a circular arrangement, determine if it is possible for Ming to balance the stones.
Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. The input will consist of a single string s (1 ≤ |s| ≤ 105), with only the characters capital ‘B’ and ‘W’. The stones are arranged in a circle, so the first stone and the last stone are adjacent.
Output 1 if it is possible for Ming to balance the stones with his rules. Otherwise, output 0.