#D1. Letter Game

Letter Game

Description

A single-player game with the following rules: On an R-row by C-column grid, each cell contains a letter from AA to ZZ. The game starts from the top-left corner (first row, first column) and moves step by step to adjacent cells (up, down, left, right). The only constraint is that each letter on the path can only appear once.
The goal of the game is to traverse the longest possible path. Please write a program to calculate the maximum number of steps that can be taken on a given chessboard.

Format

Input

The first line contains two integers RR and CC separated by a space. The following RR lines each contain SS letters, representing the state of each row on the chessboard.

Output

There is only one line, which is the longest step count you calculated.

Samples

input1

2 4
CAAB
ADCB

output1

3

input2

3 6
HFDFFB
AJHGDH
DGAGEH

output2

6

Instructions

Data range: 1R,S201 ≤ R, S ≤ 20.