One case is not showing correct

when using
String b=sc.nextLine();
its giving wrong answer

when using
String b=sc.next();
its giving TLE

rest all cases are working properly , only this case is not giving answer

@Himanshu-Jhawar-2273952536067590
nextLine() will not work as both txt and pattern are provided in same line. Use next() only. As for TLE, have you considered the case when you get a pattern with multiple consecutive *. Can you do some optimisation for that testcase ?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.