F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Super-palindrome

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3126    Accepted Submission(s): 1611


Problem Description
比赛题目可以自行下载:http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdf

You are given a string that is consisted of lowercase English alphabet. You are supposed to change it into a super-palindrome string in minimum steps. You can change one character in string to another letter per step.

A string is called a super-palindrome string if all its substrings with an odd length are palindrome strings. That is, for a string s, if its substring $s_{i\cdots j} $ satisfies $ j-i+1 $ is odd then $s_{i+k}=s_{j-k} $ for $ k = 0 , 1 , \cdots j-i+1 $.
 

Input
The first line contains an integer $ T\left( 1 \leq T \leq 100 \right) $ representing the number of test cases.

For each test case, the only line contains a string, which consists of only lowercase letters. It is guaranteed that the length of string satisfies $ 1 \leq \vert s \vert \leq 100 .$
 

Output
For each test case, print one line with an integer refers to the minimum steps to take.
 

Sample Input
3 ncncn aaaaba aaaabb
 

Sample Output
0 1 2
 

Hint
For second test case aaaaba, just change letter b to a in one step.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2025-04-01 09:40:39, Gzip enabled