Wrong test cases in string window#

testcase10:
Manually checking test cases gives a shorter string , so does my code but output in testcase 10 is wrong. judged output is “caodainabshgblocbsjasbk” and my output is “dinihgbl.sksjsoc”, both are sub-strings but my answers has smaller length.
regarding time limit in test case 8…it is a rather small string to check and my code outputs the correct sub-string while test case 2 does not gives any time limit , it is much larger input to process.

code: https://ide.codingblocks.com/s/105420

is it because not only the elements should be in the substring but also when some char is repeated in string 2 then sub-string should also have repetition ?

timelimit in case 8 is baffling, having already processed much larger string…