i try to solve this problem for two days but i always get wrong answer on test 7 here is my submission i use bfs with memomization and i take the smallest character after every step .
please can someone help me to get this submission accepted and any solution will be appricated.