{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eGiven two sequences of words: X\u003d(x\u003csub\u003e1\u003c/sub\u003e,...,x\u003csub\u003en\u003c/sub\u003e) and Y\u003d(y\u003csub\u003e1\u003c/sub\u003e,...,y\u003csub\u003en\u003c/sub\u003e), determine how many binary sequences P\u003d(p\u003csub\u003e1\u003c/sub\u003e,...,p\u003csub\u003en\u003c/sub\u003e) exist, such \r\n\tthat the word concatenation z\u003csub\u003e1\u003c/sub\u003ez\u003csub\u003e2\u003c/sub\u003e...z\u003csub\u003en\u003c/sub\u003e, where z\u003csub\u003ei\u003c/sub\u003e\u003dx\u003csub\u003ei\u003c/sub\u003e iff p\u003csub\u003ei\u003c/sub\u003e\u003d1 and z\u003csub\u003ei\u003c/sub\u003e\u003dy\u003csub\u003ei\u003c/sub\u003e iff p\u003csub\u003ei\u003c/sub\u003e\u003d0,\r\n\tis a palindrome (a word which is the same when read from left to right and from \r\n\tright to left).\r\n\u003c/p\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003e\r\n\tThe input begins with the integer t, the number of test cases. Then t test \r\n\tcases follow.\r\n\u003c/p\u003e\r\n\u003cp\u003e\r\n\tFor each test case the first line contains the positive integer n - the number \r\n\tof words in a sequence (1\u0026lt;\u003dn\u0026lt;\u003d30). The following n lines contain \r\n\tconsecutive words of the sequence X, one word per line. The next n lines \r\n\tcontain consecutive words of the sequence Y, one word per line. Words consist \r\n\tof lower case letters of the alphabet (\u0027a\u0027 to \u0027z\u0027), are non-empty, and not \r\n\tlonger than 400 characters.\r\n\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003e\r\n\tFor each test case output one line containing a single integer - the number of \r\n\tdifferent possible sequences P.\r\n\u003c/p\u003e\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e\r\n1\r\n5\r\nab\r\na\r\na\r\nab\r\na\r\na\r\nbaaaa\r\na\r\na\r\nba\r\n\r\n\u003cb\u003e\u003c/b\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\r\n12\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\r\n\n\u003c/div\u003e"}}]}