Problem A. Super-palindrome
You are given a string that is consistedof lowercase English alphabet. You are supposed to change it into asuper-palindrome string in minimum steps. You can change one character instring to another letter per step.
A string is called asuper-palindrome string if all its substrings with an odd length are palindromestrings. That is, for a string s, if its substring si···j satisfies j −i + 1 is oddthen si+k = sj−k fork= 0,1,··· ,j− i + 1.
Input
The first line contains an integer T (1 ≤ T ≤100) representing the number of test cases.
For each test case, the only line containsa string, which consists of only lowercase letters. It is guaranteed that thelength of string satisfies 1 ≤ |s| ≤ 100.
Output
For each test case, print one line with aninteger refers to the minimum steps to take.
Example
standard input |
| standard output |
3 ncncn aaaaba aaaabb | 0 1 2 |
|
Explanation
For second testcase aaaaba, just change letter bto a in one step.
#include#define maxn 1005using namespace std;string str,tmp;bool vis[maxn];int main(){ int t; cin>>t; while(t--){ cin>>str; memset(vis,0,sizeof(vis)); for(int i=0;i