Problems
Crossword
Crossword
You drew a grid for a crossword puzzle, and now need to fill in his words. To do this you need to know how many words in the crossword puzzles of a certain length. Write a program that performs these calculations.
\InputFile
In the input file a few tests. In the first line of each test contains two integers \textbf{N }and\textbf{ M} through space - the size of the grid crossword (\textbf{3} ≤ \textbf{N}\textit{ } ≤ \textbf{50}, \textbf{3} ≤ \textbf{M}\textit{ } ≤ \textbf{50}). This is followed by \textbf{N} lines, each containing \textbf{M} symbols '\textbf{.}' (empty cell) and '\textbf{X}' (black, unused cell). A string containing "\textbf{0} \textbf{0}", signals the completion of the test suite and is not processed.
\OutputFile
In the output file for each test to bring a string containing information about the number of words of each length in the form of \textbf{L}−\textbf{K} through a gap in the ascending order of \textbf{L}, where \textbf{L} -- length of words (\textbf{L} ≥ \textbf{2}), \textbf{K} -- number of words of such length (\textbf{K}\textit{ } > \textbf{0}).
Input example #1
5 6 X....X X.XX.X ...X.. X.XX.X ..X... 3 3 ... ... ... 0 0
Output example #1
2-2 3-2 4-1 5-2 3-6