字符串
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
给定长度为 的字符串 ,令 表示将 中前 个字符截取后按原顺序放到 末尾,所得到的字符串。
如假设 为 abcde
,则 为 abcde
, 为 bcdea
, 为 cdeab
, 为 deabc
, 为 eabcd
。
回文串指顺读和倒读都一样的字符串。
若对于所有在 内的 , 都是回文串,则称 为完美回文串。
青蛙哥拿到了一个字符串 ,每次操作青蛙哥可以指定字符串中的一个位置,将其修改为任意一个字母,求将 变成完美回文串的最少操作次数。
Format
Input
本题有多组数据。
第一行一个正整数 表示数据组数,对于每组数据:
输入一行一个字符串表示青蛙哥拿到的字符串 。
Output
对于每组数据,输出一行一个整数,表示最少操作次数。
Samples
样例输入
2
abcb
xxx
样例输出
2
0
Limitation
对于 的数据, 。
对于另外 的数据,,字符串中只包含 a
和 b
两个字母。
对于 的数据,,字符串中只包含小写字母。
20250220周赛
- Status
- Done
- Rule
- IOI
- Problem
- 7
- Start at
- 2025-2-20 16:30
- End at
- 2025-2-20 18:30
- Duration
- 2 hour(s)
- Host
- Partic.
- 26