{"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\"\u003eAs a cute girl, Kotori likes playing ``Hide and Seek\u0027\u0027 with cats particularly.\u003cbr\u003eUnder the influence of Kotori, many girls and cats are playing ``Hide and Seek\u0027\u0027 together.\u003cbr\u003eKoroti shots a photo. The size of this photo is $n\\times m$, each pixel of the photo is a character of the lowercase(from `a\u0027 to `z\u0027).\u003cbr\u003eKotori wants to know how many girls and how many cats are there in the photo.\u003cbr\u003e\u003cbr\u003eWe define a girl as -- we choose a point as the start, passing by 4 different connected points continuously, and the four characters are exactly ``girl\u0027\u0027 in the order.\u003cbr\u003eWe define two girls are different if there is at least a point of the two girls are different.\u003cbr\u003eWe define a cat as -- we choose a point as the start, passing by 3 different connected points continuously, and the three characters are exactly ``cat\u0027\u0027 in the order.\u003cbr\u003eWe define two cats are different if there is at least a point of the two cats are different.\u003cbr\u003e\u003cbr\u003eTwo points are regarded to be connected if and only if they share a common edge.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line is an integer $T$ which represents the case number.\u003cbr\u003e\u003cbr\u003eAs for each case, the first line are two integers $n$ and $m$, which are the height and the width of the photo.\u003cbr\u003eThen there are $n$ lines followed, and there are $m$ characters of each line, which are the the details of the photo.\u003cbr\u003e\u003cbr\u003eIt is guaranteed that:\u003cbr\u003e$T$ is about 50.\u003cbr\u003e$1\\leq n\\leq 1000$.\u003cbr\u003e$1\\leq m\\leq 1000$.\u003cbr\u003e$\\sum (n\\times m)\\leq 2\\times 10^6$.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"As for each case, you need to output a single line.\u003cbr\u003eThere should be 2 integers in the line with a blank between them representing the number of girls and cats respectively.\u003cbr\u003e\u003cbr\u003ePlease make sure that there is no extra blank.\u003cbr\u003e\u003cbr\u003e"}},{"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\u003e3\r\n1 4\r\ngirl\r\n2 3\r\noto\r\ncat\r\n3 4\r\ngirl\r\nhrlt\r\nhlca\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 0\r\n0 2\r\n4 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}