{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003e\u003ci\u003eHello Denis,\u003cbr\u003e\u003cbr\u003e\r\nYour internship in Team.GOV is over.\r\nUnfortunately, we cannot make you a full-time offer.\r\nDon\u0027t be upset, because you are neither the first nor the last one.\r\nIt was a great pleasure to work with you.\r\nWe wish you best of luck.\u003cbr\u003e\u003cbr\u003e\r\nRegards,\r\nVadim Kantorov, the captain of Team.GOV\u003c/i\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003e\u003cbr\u003eA freezing November night in the year of 2010.\r\nThe dormitory of Department of Mathematics and Mechanics\r\nof Ural State University.\r\nDim monitor light.\r\nThat\u0027s how Den Mukhametianov (the 8th team member in succession)\r\nleft Team.GOV.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eAt the beginning of September Den returned from hot summer vacations. \r\nHe was calmly browsing the photos from a trip when he got an email “You are invited to an interview with Team.GOV”.\r\nA year before Den could only dream of this.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe picture emerges in the mind as if it all had been yesterday.\r\nIt was a small cozy room, Vadik settled comfortably in a rocking chair.\r\nDen coughed awkwardly and shitfed his feet.\r\nVadik looked up and smiled.\r\n“What experience have you got?”\u003cbr\u003e\r\n“Half a year in Ural SU AirBug and half a year in Ural SU Quickov.”\u003cbr\u003e\r\n“Hm, not bad. What\u0027s your favorite topic?”\u003cbr\u003e\r\n“String algorithms.”\u003cbr\u003e\r\n“Well, then straight to the point then,” Vadik interrupted Den. “Let\u0027s\r\npick a problem. Do you know what is Hamming distance between two strings of\r\nequal lengths?”\u003cbr\u003e\r\n“Yes, it\u0027s the number of positions on which the characters of the strings\r\nare not equal.”\u003cbr\u003e\r\n“Exactly! Let\u0027s define the distance from a pattern \u003ci\u003ep\u003c/i\u003e to a string \u003ci\u003es\u003c/i\u003e as\r\nthe sum of Hamming distances from \u003ci\u003ep\u003c/i\u003e to all substrings of \u003ci\u003es\u003c/i\u003e of length |\u003ci\u003ep\u003c/i\u003e|.\r\nIn the string and in the pattern some characters are erased. You need to\r\nrecover the erased characters in such a way that the distance from \u003ci\u003ep\u003c/i\u003e to \u003ci\u003es\u003c/i\u003e\r\nis minimal.”\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 the string \u003ci\u003es\u003c/i\u003e, the second contains the pattern \u003ci\u003ep\u003c/i\u003e.\r\nBoth strings are not empty and their lengths don\u0027t exceed 1000.\r\nStrings are comprised of the following characters: “0”, “1” and “?”.\r\nHere, “?” stands for erased characters that you need to recover.\r\nLength of \u003ci\u003ep\u003c/i\u003e doesn\u0027t exceed length of \u003ci\u003es\u003c/i\u003e.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line should contain the minimal distance from \u003ci\u003ep\u003c/i\u003e to \u003ci\u003es\u003c/i\u003e\r\nafter all erased characters are recovered.\r\nIn the second and in the third line output \u003ci\u003es\u003c/i\u003e and \u003ci\u003ep\u003c/i\u003e respectively\r\nwhere each character “?” is replaced with either “0” or “1”.\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\u003e00?\r\n1?\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n000\r\n10\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}