308639: CF1551B1. Wonderful Coloring - 1
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Wonderful Coloring - 1
题意翻译
给定一个由小写字母组成的字符串 $s$ ($|s|\le50$),将其用红色和绿色染色,满足 * 每个点或被染成红色,或被染成红色,亦或不被染色 * 同色的任两个字母不相同 * 染成红色的字母数量等于染成绿色的字母数量 求红色染的字母的数量的最大值 如下图就是对 $\texttt{kzaaa}$ 的最佳染色方案之一 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1551B1/c8856daa04b74978f65da846cae3db3aad690b80.png) __多组数据__题目描述
This is a simplified version of the problem B2. Perhaps you should read the problem B2 before you start solving B1. Paul and Mary have a favorite string $ s $ which consists of lowercase letters of the Latin alphabet. They want to paint it using pieces of chalk of two colors: red and green. Let's call a coloring of a string wonderful if the following conditions are met: 1. each letter of the string is either painted in exactly one color (red or green) or isn't painted; 2. each two letters which are painted in the same color are different; 3. the number of letters painted in red is equal to the number of letters painted in green; 4. the number of painted letters of this coloring is maximum among all colorings of the string which meet the first three conditions. E. g. consider a string $ s $ equal to "kzaaa". One of the wonderful colorings of the string is shown in the figure. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1551B1/c8856daa04b74978f65da846cae3db3aad690b80.png)The example of a wonderful coloring of the string "kzaaa".Paul and Mary want to learn by themselves how to find a wonderful coloring of the string. But they are very young, so they need a hint. Help them find $ k $ — the number of red (or green, these numbers are equal) letters in a wonderful coloring.输入输出格式
输入格式
The first line contains one integer $ t $ ( $ 1 \le t \le 1000 $ ) — the number of test cases. Then $ t $ test cases follow. Each test case consists of one non-empty string $ s $ which consists of lowercase letters of the Latin alphabet. The number of characters in the string doesn't exceed $ 50 $ .
输出格式
For each test case, output a separate line containing one non-negative integer $ k $ — the number of letters which will be painted in red in a wonderful coloring.
输入输出样例
输入样例 #1
5
kzaaa
codeforces
archive
y
xxxxxx
输出样例 #1
2
5
3
0
1