cho.sh
Notes
Loading...

Matchstick Grid

Time limit

2s

Memory limit

128 MB

Problem

A 3 by 3 grid can contain up to 24 matchsticks as shown below. Two consecutive - characters represent one horizontal matchstick, and two consecutive | characters represent one vertical matchstick.

+--+--+--+|..|..|..||..|..|..|+--+--+--+|..|..|..||..|..|..|+--+--+--+|..|..|..||..|..|..|+--+--+--+

Each + marks a vertex where two or more matchsticks may meet; there are 16 such vertices. Every other background cell is written as ..

When all 24 matchsticks are present, the drawing contains 14 complete squares: nine 1 by 1 squares, four 2 by 2 squares, and one 3 by 3 square. Removing some matchsticks can reduce that number. In the arrangement below, 5 matchsticks have been removed and only 4 complete squares remain.

+--+--+--+|..|..|..||..|..|..|+--+--+..+|.....|..||.....|..|+--+--+..+|........||........|+--+--+--+

Given a matchstick arrangement, let A be the number of removed matchsticks and B be the number of complete squares that remain. Write a program that computes A and B.

Input

The input consists of 10 lines describing the matchstick arrangement. Each line has length 10, and every character is one of -, |, +, or .. The input always follows the grid format described above.

Output

Print A and B on one line, separated by a space.

+--+--+--+|..|..|..||..|..|..|+--+--+--+|..|..|..||..|..|..|+--+--+--+|..|..|..||..|..|..|+--+--+--+
+--+--+--+|..|..|..||..|..|..|+--+--+..+|.....|..||.....|..|+--+--+..+|........||........|+--+--+--+