{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" height\u003d\"265px\" src\u003d\"CDN_BASE_URL/f07ca18125781fd3b295988bcec545bb?v\u003d1715286106\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\" width\u003d\"151px\"\u003e \u003c/center\u003e A mason\u0027s mark is a symbol often found on dressed stones in buildings and other public structures. As Peter walks with his camera through Paris, he notices these marks on the wall of the Tour Jean-Sans-Peur. Every stone has one of the marks A, B or C, which are quite visible. He makes a black and white photo and observes : \u003cul\u003e \u003cli\u003e The picture shows stones, and every stone contains exactly one mark. \u003c/li\u003e\u003cli\u003e All marks have one of the following shapes with $$$x$$$ and $$$y$$$ being arbitrary strictly positive integers, and possibly different for each mark. Note that marks are surrounded by white pixels and that marks cannot be rotated. \u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" height\u003d\"189px\" src\u003d\"CDN_BASE_URL/cd238cc06a10717c5d6cd1dde730263d?v\u003d1715286106\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\" width\u003d\"491px\"\u003e \u003c/center\u003e \u003c/li\u003e\u003cli\u003e The picture contains some noise, which are black pixels surrounded by $$$8$$$ white pixels. \u003c/li\u003e\u003cli\u003e There are $$$3$$$ kinds of black pixels, corresponding respectively to the noise, the mason\u0027s marks, and the region around the stones. \u003c/li\u003e\u003cli\u003e Every white pixel belongs to the surface of a stone and some of them also belong to the interior of a mark. \u003c/li\u003e\u003cli\u003e The white pixels belonging to the surface of the same stone but not belonging to the interior of the mark are all connected with respect to vertical and horizontal adjacency. However, the surface of a stone may be non-convex. \u003c/li\u003e\u003cli\u003e The black pixels of the region around the stones are connected with respect to vertical, horizontal, diagonal, and anti-diagonal adjacency, which means that you can go from any black pixel of the region around the stones to any other such pixel by moving from one pixel to one of its eight adjacent pixels. All pixels of the border of the picture are black and belong to this region. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYou are given a rectangular matrix representing a picture made by Peter. The \u0027#\u0027 character represents a black pixel and the \u0027.\u0027 character a white pixel. You should count how many stones are on the picture with the respective letters A, B, and C.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains two integers $$$W$$$ and $$$H$$$. The next $$$H$$$ lines each contain a string of length $$$W$$$. The strings are composed of \u0027.\u0027 and \u0027#\u0027.\u003c/p\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eLimits\u003c/span\u003e \u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$7 \\le W \\le 1000$$$; \u003c/li\u003e\u003cli\u003e $$$9 \\le H \\le 1000$$$. \u003c/li\u003e\u003c/ul\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eThe 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.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e26 15\n##########################\n##........######......#..#\n#...###....#####..#......#\n#...#.#....####.........##\n#...###.....##....#####..#\n#...#.#.....#.....#####..#\n#...###.....#.....##.##..#\n#........#..#.#...#####..#\n#..###......#.....#####..#\n#..#........#...#.##.##..#\n#..#........#.....##.##..#\n#..#...#.#..#...#.##.##..#\n#..###......#............#\n###....#....##....##.....#\n##########################\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eSample Explanation\u003c/span\u003e\u003c/p\u003e\u003cp\u003eThere 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.\u003c/p\u003e"}}]}