Server Time: Tue Nov 19, 2019 9:39 am
Welcome ( logout
1025 - The Specials Menu
  PDF (English) Statistics Forum
Time Limit: 2 second(s) Memory Limit: 32 MB

Feuzem is an unemployed computer scientist who spends his days working at odd-jobs. While on the job he always manages to find algorithmic problems within mundane aspects of everyday life.

Today, while writing down the specials menu at the restaurant he's working at, he felt irritated by the lack of palindromes (strings which stay the same when reversed) on the menu. Feuzem is a big fan of palindromic problems, and started thinking about the number of ways he could remove letters from a particular word so that it would become a palindrome.

Two ways that differ due to order of removing letters are considered the same. And it can also be the case that no letters have to be removed to form a palindrome.


Input starts with an integer T (≤ 200), denoting the number of test cases.

Each case contains a single word W (1 ≤ length(W) ≤ 60).


For each case, print the case number and the total number of ways to remove letters from W such that it becomes a palindrome.

Sample Input

Output for Sample Input





Case 1: 15

Case 2: 8

Case 3: 11


Problem Setter: Muntasir Muzahid Chowdhury
Special Thanks: Jane Alam Jan (Dataset)
Developed and Maintained by
Copyright © 2012
LightOJ, Jane Alam Jan