1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string s; int count = 0;
    cin >> s;
    for(int i = 0 ; i < s.size()/2 ; ++i)if(s[i] != s[s.size()-1-i]) count += 1;
    if(count%2==1 && s.size()%2 == 0)cout << -1;
    else cout << (count+1)/2;

    return 0;
}