TLE on submission of code

how can i reduce the time complexity of the code?
The link for the code is given below:

@shubham_garud5

add this condition in the starting of the function

if (a.length() != b.length()) {
        return false;
}

the code you shared has a lot of minor syntax errors, please fix those too

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.