eolymp
bolt
Try our new interface for solving problems
Problems

Peg Game

Peg Game

To a certain logic game "Peg" player jumps one chip through the other, after which those tokens, through which was to make a jump, removed from the board. The game lasts as long as there will be one piece. The playing field has a size of \textbf{7}x\textbf{7}. The initial position of chips on the playing field is as follows: ooo ooo ooooooo ooo.ooo ooooooo ooo ooo A small letter '\textbf{o}' corresponds to the chip, the point '\textbf{.}' corresponds to the empty field. A player may choose from one chip and one of the four directions (up, down, left, right), if in this direction on the adjacent field there is another chip and free field right behind her. Selected chip jumps over another chip and installed in the free field behind her. The chip, through which was to make a jump, removed from the board. Over the border the playing field can not go. Write a program that, given the current arrangement of chips determines the number of moves that can make a player from this position. \InputFile The input file contains a description of the current position. The position is given seven lines, each containing exactly seven characters. The first two and last two characters of the first two and last two lines are always spaces. All other characters - or the point '\textbf{.}', Or a small Latin letter '\textbf{o}'. \OutputFile Display single number - the number of moves. Conclusion number should be carried out with a line break. Display single number - the number of moves. Conclusion number should be carried out with a line break.
Time limit 1 second
Memory limit 64 MiB
Input example #1
  o.o  
  .o.  
o.ooo.o
.oo.oo.
o.ooo.o
  .o.  
  o.o  
Output example #1
16
Source Crimea 2010