{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e Dear contestant, now you are an excellent navy commander, who is responsible of a tough mission currently.\u003cbr\u003e\u003cbr\u003e Your fleet unfortunately encountered an enemy fleet near the South Pole where the geographical conditions are negative for both sides. The floating ice and iceberg blocks battleships move which leads to this unexpected engagement highly dangerous, unpredictable and incontrollable. \u003cbr\u003e\u003cbr\u003e But, fortunately, as an experienced navy commander, you are able to take opportunity to embattle the ships to maximize the utility of cannons on the battleships before the engagement. \u003cbr\u003e\u003cbr\u003e The target is, arrange as many battleships as you can in the map. However, there are three rules so that you cannot do that arbitrary:\u003cbr\u003e\u003cbr\u003e A battleship cannot lay on floating ice\u003cbr\u003e A battleship cannot be placed on an iceberg\u003cbr\u003e\u003cbr\u003e Two battleships cannot be arranged in the same row or column, unless one or more icebergs are in the middle of them.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":" There is only one integer T (0\u0026lt;T\u0026lt;12) at the beginning line, which means following T test cases.\u003cbr\u003e\u003cbr\u003e For each test case, two integers m and n (1 \u0026lt;\u003d m, n \u0026lt;\u003d 50) are at the first line, represents the number of rows and columns of the battlefield map respectively. Following m lines contains n characters iteratively, each character belongs to one of ‘#’, ‘*’, ‘o’, that symbolize iceberg, ordinary sea and floating ice."}},{"title":"Output","value":{"format":"HTML","content":" For each case, output just one line, contains a single integer which represents the maximal possible number of battleships can be arranged."}},{"title":"Sample","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\u003e2\r\n4 4\r\n*ooo\r\no###\r\n**#*\r\nooo*\r\n4 4\r\n#***\r\n*#**\r\n**#*\r\nooo#\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}