Balls of Buma
Balph is learning to play a game called Buma. In this game, he is given a row of colored balls. He has to choose the color of one new ball and the place to insert it (between two balls, or to the left of all the balls, or to the right of all the balls).
When the ball is inserted the following happens repeatedly: if some segment of balls of the same color became longer as a result of a previous action and its length became at least , then all the balls of this segment are eliminated.
Consider, for example, a row of balls . Suppose Balph chooses a ball of color and the place to insert it after the sixth ball, i. e. to the left of the two 's. After Balph inserts this ball, the balls of color are eliminated, since this segment was made longer and has length now, so the row becomes . The balls of color are eliminated now, because the segment of balls of color became longer and has length now. Thus, the row becomes . However, none of the balls are eliminated now, because there is no elongated segment.
Help Balph count the number of possible ways to choose a color of a new ball and a place to insert it that leads to the elimination of all the balls.
Input
The only line contains a non-empty string of uppercase English letters of length at most . Each letter represents a ball with the corresponding color.
Output
Output the number of ways to choose a color and a position of a new ball in order to eliminate all the balls.