Paired string
Description
Some strings are called pairs if they meet the following requirements:
A. All characters appear even in the string
B. Each pair of identical characters does not contain any odd number of characters.
Now, you can check whether these strings are correct strings.
Input:
The first line is an integer K, indicating the number of test cases, and the next line is a test case. Each behavior is a string (up to 1000 characters ).
Output:
Each row outputs the results of a test case. If Yes, Yes is output; otherwise, No is output.
Sample Input
2
AAbbAaaabbcc
Abcdefghijklmn
Sample Output
Yes
No
# Include <iostream>
Using namespace std;
Char str [1000];
Int cNum [100];
Int main ()
{
Int cas;
Cin> cas;
While (cas --)
{
Scanf ("% s", str );
Int k = strlen (str );
Memset (cNum, 0, sizeof (cNum ));
Int I = 0;
Int sum = 0;
If (k % 2)
{
Cout <"No" <endl;
Continue;
}
While (I <k)
{
If (cNum [str [I] = 0)
{
CNum [str [I] = I + 1;
}
Else
{
If (I-cNum [str [I]) % 2 = 0) {sum + = 2; cNum [str [I] = 0 ;}
}
I ++;
}
If (sum = k)
Cout <"Yes" <endl;
Else
Cout <"No" <endl;
}
Return 0;
}
From my dream and my dream ~~~
Climb to the top of the hill ~~~