You are given a rectangular matrix representing a picture made by Peter. The '#' character represents a black pixel and the '.' character a white pixel. You should count how many stones are on the picture with the respective letters A, B, and C.
The first line contains two integers $$$W$$$ and $$$H$$$. The next $$$H$$$ lines each contain a string of length $$$W$$$. The strings are composed of '.' and '#'.
Limits
The output should consist of a single line, whose content is three integers $$$A$$$, $$$B$$$, and $$$C$$$ separated with single spaces, indicating the number of stones with the respective marks A, B, and C.
26 15 ########################## ##........######......#..# #...###....#####..#......# #...#.#....####.........## #...###.....##....#####..# #...#.#.....#.....#####..# #...###.....#.....##.##..# #........#..#.#...#####..# #..###......#.....#####..# #..#........#...#.##.##..# #..#........#.....##.##..# #..#...#.#..#...#.##.##..# #..###......#............# ###....#....##....##.....# ##########################
1 1 0
Sample Explanation
There are black pixels forming a letter C. These pixels, however, belong to the region around the stones and do not form a mark since they are not surrounded by white pixels.
Name |
---|