LearnPy Hub
← Arena
AdvancedRating 1700

Different Island Shapes

Count the different island shapes in the grid. Two islands (# cells connected up, down, left, right) have the same shape if one can be slid onto the other without rotating or flipping.

Input

r and c, then r rows.

Output

One integer.

Sample 1

Input
4 5
##.##
#...#
.....
##.##
Output
3

Sample 2

Input
4 5
##...
##...
...##
...##
Output
1
solution.py
Output appears here
Different Island Shapes · Python Arena problem · LearnPy Hub