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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.4, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.