SWPAIR - SWEET PAIRS
Kalyan has many sweet boxes. Each box is coloured red, green, blue, or white. As Diwali is approaching, Kalyan has to gift each of his friends a pair of sweet boxes of the same colour. Find if he can form complete pairs (of same colour) from these sweet boxes??
Input (STDIN):
The first line contains the number of test cases T. The next T lines contain a string c having N characters. The ith character of the string is either 'R', 'G', 'B' or 'W', denoting that the ith box has color red, green, blue, or white respectively. There is no blank line between test cases.
Output (STDOUT):
For each test case, output "YES" if all boxes can be grouped in pairs, or "NO" otherwise.
Constraints:
1 <= T <= 1000
The string c contains at most 50 characters.
Each character of c is either 'R', 'G', 'B' or 'W'.
Sample Input: 2 RGGGRG RGBGRW Sample Output: YES NO
Added by: | kousik |
Date: | 2013-09-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ASM32-GCC MAWK BC C-CLANG C NCSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JAVA JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYTHON PYPY PYPY3 PYTHON3 PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET |