405646: GYM102020 M Marvelous Necklace

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Marvelous Necklacetime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

As you already know, since it is not that unusual, John has two friends that were born on the same day. He bought a magical necklace to give out as a birthday gift to them. This necklace is made of jewels of two colors ($$$A$$$ and $$$B$$$), and allows you to make two cuts. After the cuts, John can create a new necklace with each of the two resulting pieces.

John would like to make two cuts on the necklace in such a way that the two resulting necklaces had the same amount of jewels of each color, that is, the number of jewels of color $$$A$$$ is equal on both necklaces, and the same goes for color $$$B$$$.

The necklace can be represented as a string $$$s$$$, containing only characters $$$A$$$ and $$$B$$$, and each of the cuts can be represented by an integer $$$x$$$ $$$(1 \le x \le |s|)$$$, denoting that the cut was made exactly before the $$$x$$$-th jewel of the string. Note that a necklace has a circular structure, so, the last jewel comes exactly before the first one.

Input

The input consists of a single line containing a string $$$s$$$ $$$(0 < |s| \le 10^5)$$$, representing the necklace.

Output

On the first line of the output, print $$$"$$$YES$$$"$$$ (without quotes) if its possible to cut the necklace according to John's wishes and $$$"$$$NO$$$"$$$ (without quotes) otherwise. In case its possible, the second line must have $$$2$$$ integers, indicating the position of each cut John must make. You can output the indices of the cuts in any order you'd like, and, in case there is more than one solution, you can output any of them.

ExamplesInput
AAAAAAA
Output
NO
Input
AABB
Output
YES
2 4
Input
BBAABABBBAAAAAA
Output
NO
Input
BB
Output
YES
1 2

加入题单

算法标签: