Problem:
Score : 200 points

Problem Statement

Takahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.

Given is a string S. Find the minimum number of hugs needed to make S palindromic.

Constraints

S is a string consisting of lowercase English letters.

The length of S is between 1 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:

S

Output

Print the minimum number of hugs needed to make S palindromic.

Sample Input 1

redcoder

Sample Output 1

1

For example, we can change the fourth character to o and get a palindrome redooder.

Sample Input 2

vvvvvv

Sample Output 2

0

We might need no hugs at all.

Sample Input 3

abcdabc

Sample Output 3

2

Solution in C (GCC 5.4.1) (judge verdict: Accepted)

#include <stdio.h>
#include <string.h>

/*--- 文字列strの長さを返す ---*/
unsigned str_length(const char str[])
{
    unsigned len = 0;
    while (str[len])
        len++;
    return (len);
}

/*--- 文字列を逆順に並べ替える ---*/
void rev_string(char str[])
{
    int i;
    int len = str_length(str);
    for (i = 0; i < len / 2; i++) {
        char temp = str[i];
        str[i] = str[len-i-1];
        str[len-i-1] = temp;
    }
}

//文字列の切り出し
int substr( char *t, const char *s, int pos, int len )
{
    if( pos < 0 || len < 0 || len > strlen(s) )
        return -1;
    for( s += pos; *s != '\0' && len > 0; len-- )
        *t++ = *s++;
    *t = '\0';
    return 0;
}


int main(void)
{
    int len,i,count;
    char str[100];
    char s[100];
    char t[100];

    scanf("%s", str);

    len = str_length(str);

    if(len % 2==0){
        substr(s,str,0,len/2);
        substr(t,str,len/2,len/2);
        rev_string(s);

        count = 0;

        for(i=0;i<=len/2;i++){
            if(s[i]!=t[i]){
                count = count + 1;
            }
        }
    }

    if(len % 2==1){
        substr(s,str,0,(len-1)/2);
        substr(t,str,(len-1)/2 + 1,(len-1)/2);
        rev_string(s);

        count = 0;

        for(i=0;i<=(len-1)/2;i++){
            if(s[i]!=t[i]){
                count = count + 1;
            }
        }
    }

    printf("%d",count);


    return (0);
}