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



Sample input:
redcoder


Sample output:
1

Submission status: Runtime Error

Solution code:
print [S[:g]+S[g+1:]==(S[:g]+S[g+1:])[::-1] for g in range(len(S))].index(1)

Submission status: Runtime Error

Solution code:
s = input()
sb = s[:len(s)//2]
if len(s) % 2 == 1:
    sa = s[len(s)//2+1:]
else:
    sa = s[len(s)//2:]
sa = [::-1]
cnt = 0
for b in sb:
    for a in sa:
        if b != a:
            cnt += 1
        break
print(cnt)

Submission status: Runtime Error

Solution code:
import math
S = input()
s = list(S) #文字を一文字ずつリスト格納
count=0
N=math.ceil(len(s)/2)

for i in N:
 if not s[i]==s[N-i-1]:
  count+=1

print(count)

Submission status: Runtime Error

Solution code:
S = str(input())
Slist = list(S)
newlist = list(reversed(Slist))
ans != 0
for i in range((len(S)//2)):
  if Slist[i] == newlist[i]:
    ans += 1
    
print(ans)

Submission status: Runtime Error

Solution code:
a = input("Enter word:")
if a == 'redcoder':
  printf("1")
elif a == 'vvvvv':
  print("0")
elif a == "abcdabc":
  print("2")

Submission status: Runtime Error

Solution code:
s=list(input())
n=len(s)
cnt=0
for i in range(n//2):
  if s[i] != s[n-i]: cnt+=1
print(cnt)

Submission status: Runtime Error

Solution code:
S = input()
len_S = len(S)
c = 0
s = len_S // 2
for i in range(s-1):
    if S[i] == S[len_S -i]:
        c += 1
cal = s - c
print(cal)

Submission status: Runtime Error

Solution code:
S = input()
len_S = len(S)
c = 0
s = len_S // 2
for i in range(s):
    if S[i] == S[len_S -i]:
        c += 1
cal = s - c
print(cal)

Submission status: Runtime Error

Solution code:
import math

s = input()
n = len(s)

l = math.floor(n/2)
if n % 2 == 0:
  k = l
else:
  k = l+1
  

s_f = s[:l]
s_r = s[k:]
j = 0

for i in [0,l-1]:
  if s_f[i] != s_r[(l-1)-i]:
    j+=1
    
print(j)

Submission status: Runtime Error

Solution code:
from sys import stdin
input = list(stdin.readline().rstrip())

n = len(input)

if n % 2 == 1:
    del input[n//2]
    n = len(input)
cnt = 0
for i in range(n/2-1, -1, -1):
    print(i, n-i-1)
    if input[i] != input[n-i-1]:
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[x-1-i]:
    c+=1
print(c)

Submission status: Runtime Error

Solution code:
x=[i for i in input()]
count=0

if len(x)%2!=0:
  x.pop(len(x)//2+1)

P =[p for p in range(0,len(x)//2)]
Q =[q for q in range(len(x)//2,len(x))]
Q.sort(reverse=True)
for a,b in zip(P,Q):
  if x[a]!=x[b]:
    count+=1
print(count)

Submission status: Runtime Error

Solution code:
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[n-1-i]:
    c+=1
print(c)

Submission status: Runtime Error

Solution code:
a=input().strip()
x=len(a)
c=0
for i in range((x//2)+1):
  if a[i]!=a[n-1-i]:
    c+=1
print(c)
a=input().strip()

Submission status: Runtime Error

Solution code:
S = input()
rev = S[::-1]

l = int(len(S)/2)
front = S[0:l]
back = rev[0:l]

cnt = 0
moji = 0

for s in front:
    if front[cnt] == back[cnt]:
        moji += 1
    cnt += 1

ans = len - moji
print(ans)

Submission status: Runtime Error

Solution code:
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[n-1-i]:
    c+=1
print(c)

Submission status: Runtime Error

Solution code:
a = input("Enter word:")

b = a[::-1]
print(b)

Submission status: Runtime Error

Solution code:
s = list(input())
sr = []
ans=0
m = len(s)/2

for i in s[::-1]:
    sr.append(i)


for i in range(m):
    if s[i] != sr[i]:
        ans +=1

print(ans)

Submission status: Runtime Error

Solution code:
A = input()
Len = len(A)
L = (Len // 2) + (Len % 2)
count = 0
for i in range(4):
  if A[i] != A[-i-1]:
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
s = input()
a = reversed(s)
ans = 0

for i in s:
    if s[i] != a[i]:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
S=input()
n=len(str(S))
if n%2=1:
  count=0
  m=int((n-1)/2)
  for i in range(0,m):
    if S[i]!=S[n-i-1]:
      count+=1
else:
  count=0
  m=int(n/2)
  for i in range(0,m):
    if S[i]!=S[n-i-1]:
      count+=1
      
print(count)

Submission status: Runtime Error

Solution code:
S = str(input())
Slist = list(S)
newlist = list(reversed(Slist))
ans = 0
for i in range((len(S)//2)):
  if Slist[i] == newlist[i]:
    a += 1
    
print(ans)

Submission status: Runtime Error

Solution code:
import math
S=input()
S_list=[*S]
sumup=0
print(len(S_list))
if len(S_list)%2==0:
  for i in range(math.floor(len(S_list)/2)):
    if S_list[i]!=S_list[len(S_list)-i-1]:
      sumup+=1
  print(sumup)
else:
  for i in range(math.floor((len(S_list)-1)/2)):
    if S_list[i]!=S_list[len(S_list)-i-1]:
      sumup+=1
  print(sumup)

Submission status: Runtime Error

Solution code:
S=str(input())

count = 0

l = list(S)

a = len(S)

b = a - 1

for i in a:
    if l(i) != l(b-i):
        count = count + 1

count = count/2

print(count)

Submission status: Runtime Error

Solution code:
s=list(input())
count=0
if len(s)%2==0:
    for i in range(1,(len(s)//2)+1):
        if s[i-1]!=s[-i]:
            count+=1
else:
    for i in range(1,(len(s)//2))
        if s[i-1]!=s[-i]:
            count+=1
print(count)

Submission status: Runtime Error

Solution code:
a=input()
x=len(a)
c=0
if x%2:
  for i in range(x+1):
    if a[i]!=a[n-i-1]:
      c+=1
else:
  for i in range(x):
    if a[i]!=a[n-i-1]:
      c+=1
print(c)

Submission status: Runtime Error

Solution code:
S = input()

Slen = len(S)
center = int(Slen/2)

Answer = 0

a = S[:center]
if center%2 == 0:
  b = S[-1:center-1:-1]
else:
  b = S[-1:center:-1]

for i in range(len(a)):
  if a[i] != b[i]:
    Answer += 1

print(Answer)

Submission status: Runtime Error

Solution code:
    import sys
     
    s = sys.stdin.read().strip()
    c = 0
    l = len(s)
    for i in range(int(l/2)):
      if s[i] != s[l-i-1]:
        c += 1
    print(c)

Submission status: Runtime Error

Solution code:
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "13 7 2\n"
     ]
    }
   ],
   "source": [
    "all = input()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "all = input()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['13', '7', '2']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "all = [int(num) for num in all]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[13, 7, 2]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'list' object has no attribute 'sum'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-19-1727d8e1239d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mall\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m: 'list' object has no attribute 'sum'"
     ]
    }
   ],
   "source": [
    "all.sum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bust\n"
     ]
    }
   ],
   "source": [
    "if sum(all) >= 22:\n",
    "    print('bust')\n",
    "else:\n",
    "    print('win')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

Submission status: Runtime Error

Solution code:
kaibun = input()
count = 0
lenstr = len(kaibun)

if lenstr%2 ==0:
  left = kaibun[:int(lenstr/2)]
  right = kaibun[int(lenstr/2):]
else:
  left = kaibun[:math.floor(lenstr/2)]
  right = kaibun[math.floor(lenstr/2):]

for i in range(len(left)):
  back = -1 * i -1
  if left[i] != right[back]:
    count+=1
print(count)

Submission status: Runtime Error

Solution code:
string = input()
lengch = len(string)
halfLengch = lengch // 2
  startString = list(string[:halfLengch + 1])
endString = list(string[halfLengch + 2::-1])
countHug = 0

for i in startString :
  for j in endString :
    if i != j :
      countHug += 1

print(countHug)

Submission status: Runtime Error

Solution code:
s = input()
cnt = 0
flg = 0
i = 0
j = -1
while flg == 0:
	if s[i] != s[j]:
		cnt += 1
	#print (s[i],s[j])
	if len(s)//2 == i+1:
		flg =1
	i += 1
	j += -1
print (cnt)

Submission status: Runtime Error

Solution code:
def main():
    s = input()
    m = len(s)//2
    ans = 0
    if m%2 == 0:
        a = s[:m]
        b = s[m:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)
    else:
        a = s[:m]
        b = s[m+1:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
s = input()
h = 0
for i in range(len(s)//2):
  if s[i] != s[s-i-1]:
    h += 1
print(h)

Submission status: Runtime Error

Solution code:
import sys

s = sys.stdin()
c = 0
l = len(s)
for i in range(l/2):
  if s[0] != s[l-i]:
    c += 1
print(c)

Submission status: Runtime Error

Solution code:
s = list(input())
t=-1
cnt=0

for i in s[:m]:
    if i != s[t]:
        cnt+=1
    t-=1
    
print(cnt)

Submission status: Runtime Error

Solution code:
a=input()
if len(a)%2==0:
    v=len(a)/2
else:
    v=(len(a)-1)/2
c=0
for i in range(v):
    if a[i]!=a[-i-1]:
        c+=1
print(c)

Submission status: Runtime Error

Solution code:
#include <cstdio>
#include <iostream>
#include <sstream>

#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

//////////////////////////////////////////////////

int is_palindrome(string s){
  for(int i=0, j=s.length()-1;i<j;i++,j--){
    if(s[i] != s[j])return i;
  }
  return -1;
}

int main() { 
  string s;
  cin >> s;
  int ans = 0;
  while(true){
    int f = is_palindrome(s);
    if(f == -1)break;
    ans += 1;
    s[f] = s[s.length() - f - 1];
    // cerr << f << " " << s << endl;
  }
  cout << ans << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
S = list(input())
A = reversed(S)
LEN=len(S)
ans=0
if LEN%2==0:
    for i in range(LEN//2):
        if S[i]!=A[i]:
            ans+=1
else:
    for i in range((LEN-1)//2):
        if S[i]!=A[i]:
            ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
s = input()
sr = s[::-1]

ans = 0

for i in range(s//2):
  if s[i] != sr[i]:
    ans += 1
    
print(ans)

Submission status: Runtime Error

Solution code:
#include "bits/stdc++.h"5 7 5
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans = 0;
int main() {
	string S;
	cin >> S;
	n = S.length() / 2;
	rep(i, n) {
		if (S[i] != S[S.length() - 1 - i])ans++;
	}

	cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
S = input()
len_ = int(7/2)

cnt = 0
for i in range(0, len_+1):
    if S[i] !=  S[-(i+1)]:
        cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
import sys.stdin

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
s = input()
otv = 0
for i in range(0, len(s)/2):
  if s[i] != s[i + len(s)/2]:
    otv += 1
print(otv)

Submission status: Runtime Error

Solution code:
s = input()

cnt = 0
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        cnt += 1
        s[-i-1] = s[i]
print(cnt)

Submission status: Runtime Error

Solution code:
s=input()
c=0
for i in range(int(len(s)/2)):
  if s[i] != s[N-1-i]:
    c=c+1
print(c)

Submission status: Runtime Error

Solution code:

MOD = 10**9 + 7
INF = 10**20
I = lambda:list(map(int,input().split()))
from collections import defaultdict as dd
from math import gcd

s = input()
n = len(s)
ans = 0
for i in range(n//2):
    ans += (s[i] != s[n-i-1])
print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
	string S; cin >> S;
	int N = S.size();
	int ans =0;
	for(int i = 0; i < N; ++i){
		if(i>=N-1-i) break;
		if(S[i] != S[N-1-i]) ans++;
	}	
	cout << ans << endl;

}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define MP make_pair
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
  string S; cin >> S;
  string T(S); reverse(ALL(T));
  int ans = 0;
  REP(i, S.size()/2) {
    if (S[i] != T[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:

MOD = 10**9 + 7
INF = 10**20
I = lambda:list(map(int,input().split()))
from collections import defaultdict as dd
from math import gcd

s = input()
n = len(s)
ans = 0
for i in range(n//2):
    ans += (s[i] != s[n-i])
print(ans)

Submission status: Runtime Error

Solution code:
S = input()
N = len(s)
a = 0
n = N//2
for i in range(n):
    k = -(i+1)
    if S[i] != S[k]:
        a += 1
print(a)

Submission status: Runtime Error

Solution code:
def fastio():
    import sys
    from io import StringIO 
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

MOD = 10**9 + 7
INF = 10**20
I = lambda:list(map(int,input().split()))
from collections import defaultdict as dd
from math import gcd

s = input()
n = len(s)
ans = 0
for i in range(n//2):
    ans += (s[i] != s[n-i])
print(ans)