{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eFew know that the cows have their own dictionary with \u003ci\u003eW\u003c/i\u003e (1 ≤ \u003ci\u003eW\u003c/i\u003e ≤ 600) words, each containing no more 25 of the characters \u0027a\u0027..\u0027z\u0027. Their cowmunication system, based on mooing, is not very accurate; sometimes they hear words that do not make any sense. For instance, Bessie once received a message that said \"browndcodw\". As it turns out, the intended message was \"browncow\" and the two letter \"d\"s were noise from other parts of the barnyard.\u003c/p\u003e\u003cp\u003eThe cows want you to help them decipher a received message (also containing only characters in the range \u0027a\u0027..\u0027z\u0027) of length \u003ci\u003eL\u003c/i\u003e (2 ≤ \u003ci\u003eL\u003c/i\u003e ≤ 300) characters that is a bit garbled. In particular, they know that the message has some extra letters, and they want you to determine the smallest number of letters that must be removed to make the message a sequence of words from the dictionary.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Line 1: Two space-separated integers, respectively: \u003ci\u003eW\u003c/i\u003e and \u003ci\u003eL\u003c/i\u003e\r\u003cbr\u003eLine 2: \u003ci\u003eL\u003c/i\u003e characters (followed by a newline, of course): the received message\r\u003cbr\u003eLines 3..\u003ci\u003eW\u003c/i\u003e+2: The cows\u0027 dictionary, one word per line"}},{"title":"Output","value":{"format":"HTML","content":"Line 1: a single integer that is the smallest number of characters that need to be removed to make the message a sequence of dictionary words."}},{"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\u003e6 10\r\nbrowndcodw\r\ncow\r\nmilk\r\nwhite\r\nblack\r\nbrown\r\nfarmer\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}