{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"A string is said to be a palindrome if it remains same when read backwards. So, \"abba\", \"madam\" both are palindromes, but \"adam\" is not.\n\nNow, you are given a non-empty string **S**, containing only lowercase English letters. The given string may or may not be palindrome. Your task is to make it a palindrome. But you are only allowed to add characters at the right side of the string. And of course, you can add any character you want, but the resulting string has to be a palindrome, and the length of the palindrome should be as small as possible.\n\nFor example, the string is **\"bababa\"**, you can make many palindromes including:\n\n* \"bababa**babab**\"\n* \"bababa**bab**\"\n* \"bababa**b**\"\n\nSince we want a palindrome with minimum length, the solution would be **\"bababab\"** cause its length is minimum."}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026#8804; 10)**, denoting the number of test cases.\n\nEach case starts with a line containing a string **S**. You can assume that **1 \u0026#8804; length(S) \u0026#8804; 10\u003csup\u003e6\u003c/sup\u003e**."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and the length of the shortest palindrome you can make with **S**."}},{"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\u003e4\nbababababa\npqrs\nmadamimadam\nanncbaaababaaa\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 11\nCase 2: 7\nCase 3: 11\nCase 4: 19\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"Dataset is huge, use faster I/O methods."}}]}