String and palindromes
All submissions for this problem are available.You are given a string and an integer K. You have to check if the given string is formed by combining K smaller palindromic strings of equal length. ###Input: - First line contains a single integer T, denoting number of test cases. - Next T lines contains a string S and an integer K. ###Output: For every test case, you have to print "YES" if the condition is satisfied, or "NO" if not possible. ###Constraints - $1 \leq T \leq 10$ - $0 < |S| < 200000$ - $1 \leq K \leq |S|$ ###Sample Input: 2 cbbccbbccbbccbbc 4 aaaaa 2 ###Sample Output: YES NO ###EXPLANATION: In first case, the string is a combination of 4 "cbbc" smaller strings. In second case, it is not possible to form the given string with 2 smaller palindromic strings.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.