AB and Strings
All submissions for this problem are available.
Everyone know how great AB de-villiers is in the sporting world . Arpit thought AB De-villiers could do anything no matter what it is, however his brother didn’t believe him . To make his brother believe him he contacted AB and gave him a problem in which he gave him a two strings where the second string was the reverse of the first . He asked him to find the longest substring which is the prefix of both strings .
Unfortunately the call ended but to prove AB himself being master in everything he calls him back and tells him the answer . What is the answer ?
T , the number of test cases
A – string being the input string as in the problem
The query as given in the output and if no such substring can be found in the given string then output -1.
1<=length of strings<=100000
Input: 2 abcabcabcab arpit Output: Case 1: 8 Case 2: -1
|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, 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, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.