All submissions for this problem are available.
LEGO III, A computer which has strings stored in it. Ram, to improve his vocabulary, speaks with the LEGO III . So, LEGO III matches the word spoke by Ram with the stored string S and checks for the maximum match. The maximum match is to be calculated. The string stored can be numeric, alphabetic or alphanumeric.
Note: There can be more than one maximum match, in such a case, return the output in lexicography order. In case of no match return a space character.
First line contains the number of test cases T.
Following T lines have 2 strings R and L. R is the word spoke by Ram, L is the word stored by LEGO III.
For each test case, output the maximum match
2<=length of L ,R<=1000
Input: 3 A1B2C3D4 1234 SPIDERMAN SUPERMAN Output: 1234 SPERMAN
|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.