there was some troble because the last index of arraylist. if it was added in the end , it will be add again and again infinite time. i solved this problem. but subtasks not pass. as a result, the task was not completed. only one subtask not pass where if 'r' and 'l' in index not touch bit, my code not touch this index. but all works. maybe i finded alternative solution. this right but the bot cant distinguish my solution from the written one.