아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Alchemy

시간 제한1초메모리 제한1024 MB

요약
소문자 문자열이 주어질 때, 인접한 두 글자를 모두 다른 글자로 바꾸는 연산을 최소 횟수로 사용해 팰린드롬으로 만든다.
난이도

보통10점 중 6점

유형
그리디, 문자열, 투 포인터
정답자
아직 제출이 없습니다

문제

You just finished day one of your alchemy class! For your alchemy homework, you have been given a string of lowercase letters and wish to make it a palindrome. You're only a beginner at alchemy though, so your powers are limited. In a single operation, you may choose exactly two adjacent letters and change each of them into a different lowercase letter. The resulting characters may be the same as or different from one another, so long as they were both changed by the operation.

Formally, if the string before the operation is ss and you chose to change characters s_is\_i and s_i+1s\_{i+1} to produce string tt, then s_i≠t_is\_i \neq t\_i and s_i+1≠t_i+1s\_{i+1} \neq t\_{i+1} must be true, but t_i=t_i+1t\_i = t\_{i+1} is permitted.

Compute the minimum number of operations needed to make the string a palindrome.

입력

The single line of input contains a string of nn (2≤n≤100)(2 \le n \le 100) lowercase letters, the string you are converting into a palindrome.

출력

Output a single integer, which is the minimum number of operations needed to make the string a palindrome.

예제5

  1. 예제 1

    입력
    ioi
    
    예상 출력
    0
    
  2. 예제 2

    입력
    noi
    
    예상 출력
    1
    
  3. 예제 3

    입력
    ctsc
    
    예상 출력
    1
    
  4. 예제 4

    입력
    fool
    
    예상 출력
    2
    
  5. 예제 5

    입력
    vetted
    
    예상 출력
    2