아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Hotel

면접 대비

시간 제한2초메모리 제한1024 MB

요약
방과 복도로 이루어진 n x m 격자에서 사방이 복도로 둘러싸인 가장 넓은 직사각형 방의 넓이를 구한다.
난이도

보통10점 중 4점

유형
배열, 완전 탐색, 구현, 누적 합
정답자
아직 제출이 없습니다

문제

Pavel was dreaming to become an architect since his early childhood. He often drew plans of buildings on sheets of paper, and sometimes on tables and walls. Now he has a university degree and is a famous architect.

Once Pavel was digging in his child drawings and found an interesting plan of the hotel floor. The floor is a rectangle with size n×mn \times m meters. On the plan, each square corresponding to a square meter of the floor was painted with either blue or red color. After thinking a little, Pavel understood that the blue color is for corridors, and the red color stands for hotel rooms.

Since his childhood, Pavel tries to comply with international standards. Following the standards, a hotel room must be rectangular, so it should be represented on the plan as a rectangle filled with red color. Sides of the room should be parallel to the floor boundaries. Moreover, there is always a corridor running along each side of each hotel room.

In order to comply with the fire safety regulations, there should be corridors at the sides of the floor. So, the first and the last rows, as well as the first and the last columns of the plan are blue.

Looking at his plan, Pavel wondered, what is the maximal area of a hotel room on his plan. Write a program to find this area.

입력

The input file contains the description of Pavel's plan.

The first line of the input file contain two integers nn and mm (3≤n,m≤303 \le n, m \le 30). The following nn lines contain mm symbols each. The symbol "*" corresponds to a square filled with blue color (a square meter of a corridor), and the symbol "." is a red square --- a square meter of a room.

출력

In the first line of the output file print the area of the largest hotel room. If there are no rooms on the plan, print "-1".

예제3

  1. 예제 1

    입력
    5 5
    *****
    *.***
    **..*
    **..*
    *****
    
    예상 출력
    4
    
  2. 예제 2

    입력
    4 5
    *****
    *.***
    *.*.*
    *****
    
    예상 출력
    2
    
  3. 예제 3

    입력
    3 3
    ***
    ***
    ***
    
    예상 출력
    -1