Pebble Solitaire is a interesting game. This is a game where your are given a board with a arrangement of small, cavities all initially one but by a occupied Le each. The aim of the game is to remove as many pebbles as possible from the board. Pebbles disappear from the board as a. A move are possible if there is a straight line of three adjacent cavities, let us call them a, B, and C, with B in the mid Dle, where a is vacant, but B and C contain A pebble. The move constitutes of moving the pebble from C to A, and removing the pebble in bfrom the board. You could continue to make moves until no more moves are possible.
In this problem, we look at the simple variant of the this game, namely a board with twelve cavities located a line. In the beginning of each game, some of the cavities are occupied by pebbles. Your mission is to find a sequence of moves such this as few pebbles as possible are left on the board.
Input
The input begins with a positive integer n on a line of it own. Thereafter n different games follow. Each game consists of one line of input with exactly twelve characters, describing the twelve cavities of the board in Ord Er. Each character is either '-' or ' O ' (the fifteenth character of 中文版 alphabet in lowercase). A '-' (minus) character denotes a empty cavity, whereas a ' o ' character denotes a cavity with a pebble In it. As you'll find in the sample this there may to inputs where no moves is possible.
Output
For each of the "N Games in" input, output the minimum number of pebbles left on the board possible to obtain as a Resul T of moves, on a row of the its own.
Sample input Output for sample input