{"trustable":false,"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":"MD","content":"Polycarp has an n×m matrix where both n and m are equal to 2, resulting in four cells. Each cell can be colored with one of the (a-z) alphabets in English.\n\nPolycarp wants to change the colors of some cells in the matrix so that all four cells have the same color. In a single move, Polycarp can choose up to two cells of the same color and change them to a different color (if two cells are chosen, both will be changed to the same color), but he has broken his hand, so he wants your help.\n\nYour task is to calculate the minimum number of moves needed to color the matrix as he wants.\n\nInput\nThe first line contains an integer t (1≤t≤1000) — the number of test cases.\n\nEach test case consists of two lines, each containing two lowercase letters of the Latin alphabet without separators, representing a row of cells in the matrix.\n\nOutput\nFor each test case, print an integer — the minimum number of moves he needs to make so that all four cells in the matrix have the same color."}},{"title":"Input","value":{"format":"MD","content":"\u003cp\u003eThe first line contains one integer $$$t$$$ ($$$1 \\le t \\le 1000$$$) — the number of test cases.\u003c/p\u003e\u003cp\u003eEach test case consists of two lines. Each of these lines contains two lowercase letters of Latin alphabet \u003cspan class\u003d\"tex-font-style-bf\"\u003ewithout any separators\u003c/span\u003e, denoting a row of pixels in the image.\u003c/p\u003e"}},{"title":"Output","value":{"format":"MD","content":"\u003cp\u003eFor each test case, print one integer — the minimum number of moves you have to make so that all $$$4$$$ pixels of the image have the same color.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"MD","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\u003e5\nrb\nbr\ncc\nwb\naa\naa\nab\ncd\nyy\nxx\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n2\n0\n3\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}