#C11268. Minimum Operations to Palindrome

    ID: 40565 Type: Default 1000ms 256MiB

Minimum Operations to Palindrome

Minimum Operations to Palindrome

You are given a string s. Your task is to determine the minimum number of operations required to transform the string into a palindrome. In one operation, you can change a character in the string.

A palindrome is a string that reads the same forwards and backwards. For a string of length n, you only need to compare the first \(\lfloor n/2 \rfloor\) characters with the corresponding characters from the end. More formally, the minimum number of operations is given by:

[ \text{result} = \sum_{i=0}^{\lfloor n/2 \rfloor -1} \mathbb{1}_{{s[i] \neq s[n-i-1]}} ]

For example, for the string abc, only one mismatch exists (between 'a' and 'c'), so the answer is 1.

inputFormat

The input is given from standard input. The first line contains a single integer T (the number of test cases). Each of the following T lines contains a non-empty string s.

Note: The string consists of only printable characters without spaces.

outputFormat

For each test case, output a line in the format Case #i: x, where i is the test case number starting from 1, and x is the minimum number of operations required to transform the string into a palindrome.

## sample
3
abc
abca
race
Case #1: 1

Case #2: 1 Case #3: 2

</p>