In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of December 14th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #09 exercise sheet]


[AED057] Slash Maze

This problem is an adapted Mooshak version of a UVA Online Judge problem.

By filling a rectangle with slashes (/) and backslashes (\), you can generate nice little mazes. The picture below is an example.

As you can see, paths in the maze cannot branch, so the whole maze only contains cyclic paths and paths entering somewhere and leaving somewhere else. We are only interested in the cycles. In our example figure, there are two of them.

The Problem

Your task is to write a program that counts the cycles and finds the length of the longest one. The length is defined as the number of small squares the cycle consists of (the ones bordered by gray lines in the picture). In this example, the long cycle has length 16 and the short one length 4.

Input

The first line of inputs contains two numbers R and C, respectively the number of rows and columns of the maze.

L lines follow, each one with C characters, indicating the maze. Each of these characters will only be \ or /.

Output

If there are no cycles on the input maze, output "no cycles". If there is at least one, output two numbers separated by a single space: the number of cycles and the size of the largest cycle.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

1 ≤ R,C ≤75       Number of test cases

Example Input 1 Example Output 1
4 6
\//\\/
\///\/
//\\/\
\/\///
2 16

Example Input 2 Example Output 2
3 3        
///
\//
\\\
no cycles



Algorithms and Data Structures (L.EIC011) 2024/2025
DCC/FCUP & DEI/FEUP - University of Porto