{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003e\u003cb\u003eDefinition.\u003c/b\u003e Hamming distance between two strings of equal length\r\nis the number of positions in which these strings differ.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003e\u003cb\u003eDefinition.\u003c/b\u003e Distance from text \u003ci\u003es\u003c/i\u003e to pattern \u003ci\u003ep\u003c/i\u003e is the sum\r\nof all Hamming distances between the pattern and all substrings of text\r\nwhich have length |\u003ci\u003ep\u003c/i\u003e|.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eYou are given text \u003ci\u003es\u003c/i\u003e and pattern \u003ci\u003ep\u003c/i\u003e.\r\nEither text or pattern, but not both, can be damaged (some symbols are lost).\r\nYour task is to reconstruct the damaged string so that the Hamming distance\r\nbetween the text and the pattern will be the least possible.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains one integer \u003ci\u003en\u003c/i\u003e: the length of the text \u003ci\u003es\u003c/i\u003e\r\n(1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 100\u0026nbsp;000).\r\nThe second line contains the text represented as \u003ci\u003en\u003c/i\u003e integer numbers \u003ci\u003et\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\r\nseparated by whitespaces (0 ≤ \u003ci\u003et\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e ≤ 100\u0026nbsp;000).\r\nThe third line contains one integer \u003ci\u003em\u003c/i\u003e: the length of the pattern \u003ci\u003ep\u003c/i\u003e\r\n(1 ≤ \u003ci\u003em\u003c/i\u003e \u0026lt; \u003ci\u003en\u003c/i\u003e).\r\nThe fourth line contains the pattern in the same format.\r\nPositive numbers denote the number of the symbol in the alphabet, while zero\r\ndenotes a lost symbol.\r\nIt is guaranteed that if there are lost symbols in text,\r\nthere are none it pattern and vice versa.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOutput the text and the pattern separated with a line break.\r\nAll lost symbols must be reconstructed.\r\nIf there are several ways to reconstruct symbols optimally,\r\noutput any one of them.\u003c/div\u003e\u003c/div\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\u003e5\r\n1 2 3 1 2\r\n3\r\n1 2 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 2 3 1 2\r\n1 2 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}