Game with Balls#4451

Game with Balls

1 second
64 megabytes
Easy

In a popular game often played on handheld devices, the action unfolds on an by square grid, divided into smaller squares.

At the start, each square contains a ball of one of five colors: red (R), blue (B), green (G), yellow (Y), or purple (V). A connected region for a given ball includes all balls that can be reached from it by moving one square at a time, either vertically or horizontally, without crossing the grid's boundaries and only passing through balls of the same color.

When a ball is selected, all balls in its connected region are automatically selected as well. If this region contains at least balls, they disappear, and the player earns n \cdot (n-1) points, where is the number of balls in the connected region.

Given the initial arrangement of the balls, you need to determine the maximum points that can be scored on the first move by selecting a ball of each color.

Input

The input consists of lines, each containing characters, representing the playing field.

Output

For each ball color, output the maximum number of points that can be scored by selecting a ball of that color, following the format shown in the example.

Examples

Example 1

Loading
Loading