Huseyn has a string consisting of and . He had nothing to do and came up with the following game. Huseyn can do the next operation with the string:
append from the left end, and from the right end;
append from the right end, and from the left;
You are given a string after Huseyn completed all his operations (the number of performed operations can be ). Find the smallest possible length that string could have initially.
For example, from the string , you can get or .
One string of length no more than , consisting of and .
Print the smallest possible length of a string that Huseyn had originally.