{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"A palindrome partition is the partitioning of a string such that each separate substring is a palindrome.\n\nFor example, the string `ABACABA` can be partitioned in several different ways. A few are: `{A, B, A, C, A, B, A}` or `{A, BACAB, A}` or `{ABACABA}` or `{ABA, C, ABA}` among many other solutions.\n\nYou are given a string **s**. Return the minimum possible number of substrings in a palindrome partition of **s**."}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026le; 40)**, denoting the number of test cases.\n\nEach case begins with a non-empty string **s** of uppercase letters with length no more than **1000**."}},{"title":"Output","value":{"format":"MD","content":"For each case of input you have to print the case number and the desired result."}},{"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\u003e3\nAAAA\nABCDEFGH\nQWERTYTREWQWERT\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 1\nCase 2: 8\nCase 3: 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}