{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cbr\u003eYou are given a word. You can perform the only operation to this word: swap two adjacent letters. Your task is to make a palindrome from the original word using the minimal number of swaps. The palindrome is a word which is spelled the same way when reading from left to right and from right to left.\u003cbr\u003eFor example, the word \"\u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eABBYY\u003c/pre\u003e\" can be transformed to the palindrome \"\u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eYBABY\u003c/pre\u003e\" using 4 swaps:\u003cbr\u003e \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eABBYY\u003c/pre\u003e \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eBABYY\u003c/pre\u003e \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eBAYBY\u003c/pre\u003e \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eBYABY\u003c/pre\u003e \u003cpre style\u003d\"display: inline;font-size: 120.0%;\"\u003eYBABY\u003c/pre\u003e \u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/div\u003eThe only line of the input contains the given word. The word is written using capital Latin letters. The length of the word is no less than one and no more than 1000000 letters.\u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/div\u003eWrite the minimum possible number of swaps required to get a palindrome from the given word to the output. If it is impossible to get a palindrome, write -1 to the output.\u003cbr\u003e"}},{"title":"Sample 1","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\u003eMISSISSIPPI\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e13\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}