[BOJ 11195] Peragrams
View as PDFPer recently learned about palindromes. Now he wants to tell us about it and also has more awesome scientific news to share with us.</p>
“A palindrome is a word that is the same no matter whether you read it backward or forward”, Per recently said in an interview. He continued: “For example, add is not a palindrome, because reading it backwards gives dda and it’s actually not the same thing, you see. However, if we reorder the letters of the word, we can actually get a palindrome. Hence, we say that add is a Peragram, because it is an anagram of a palindrome”.
Per gives us a more formal definition of Peragrams: “Like I said, if a word is an anagram of at least one palindrome, we call it a Peragram. And recall that an anagram of a word w contains exactly the same letters as w, possibly in a different order.”
Given a string, find the minimum number of letters you have to remove from it, so that the string becomes a Peragram.
입력 형식
Input consists of a string on a single line. The string will contain at least 1 and at most 1 000 characters. The string will only contain lowercase letters a-z.
출력 형식
Output should consist of a single integer on a single line, the minimum number of characters that have to be removed from the string to make it a Peragram.
예제 입력 1
abc
예제 출력 1
2
예제 입력 2
aab
예제 출력 2
0
Comments