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 Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        String str = input.next();
        Set<String> ch = new HashSet<>();
        String s1 = str.substring(str.length()/2);
        String s2 = str.substring(0,str.length()/2);
        StringBuilder sb = new StringBuilder(s2);
        sb.reverse();
        sb = new StringBuilder(str);
        sb.reverse();
        String rev1 = sb.toString();
        String rev = sb.toString();
        int change = 0;
        String[] str1 = s1.split("");
        String[] str2 = rev.split("");
        String[] st1 = str.split("");
        String[] r1 = rev1.split("");

        int j = 0;
        if (str.length()%2 != 0) {
            for (String i : st1) {
                if (!(i.equals(r1[j]))) {
                    ch.add(i);
                }
                j++;
            }
        } else {
            if (s1 == rev) {
                System.out.println(change);
            } else {
                for (String i : str1) {
                    if (!(i.equals(str2[j]))) {
                        change += 1;
                    }
                    j++;
                }
            }
        }
        change = ch.size();
        System.out.println(change);

    }
}