Piece of cake
All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
This is a very easy warm-up problem.
You are given a string. Your task is to determine whether number of occurrences of some character in the string is equal to the sum of the numbers of occurrences of other characters in the string.
The first line of the input contains an integer T denoting the number of test cases. Each of the next T lines contains one string S consisting of lowercase latin letters.
For each test case, output a single line containing "YES" if the string satisfies the condition given above or "NO" otherwise.
Subtask #1[28 points]: S contains no more than 2 different letters.
Subtask #2[72 points]: No additional conditions
Input: 4 acab zzqzqq abc kklkwwww Output: YES YES NO YES
|Tags||ad-hoc, cakewalk, ltime20, pavel1996|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.