You are given a string S consisting of lowercase English letters. Your task is to find the maximum number of palindromic subsequences that can be created from the given string. Each palindromic subsequence must have a length greater than 1, and each element of the string can be part of atmost one palindromic subsequence.
We'll call non-empty string S[p1p2⋯pk]=Sp1Sp2⋯Spk(1≤p1<p2<⋯<pk≤|S|) subsequence of string S=S1S2⋯S|s|, where |S| is the length of string S. For example, strings "abcb", "cb" and "abacaba" are subsequences of string "abacaba".
Input format
Output format
For each test case, print the maximum number of palindromic subsequences you can create in a separate line.
Constraints
1≤T≤1002≤|S|≤104