Test case fail for one case

hello @Vikaspal
print output for each test cases in separate line.

@aman212yadav any other approaches to solve this problems better

no bro,
we need to traverse both the strings at any cost,so there is not any better approach than urs

@aman212yadav thanks aman.