Only 2 testcases are running

PROBLEM - https://hack.codingblocks.com/app/contests/1499/1506/problem

MY CODE - https://ide.codingblocks.com/s/434395

PLEASE HELP

Hello @hssharma2212000 your code is falling for test cases like these:
2
aa
bb
check this code:

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.