Write an algorithm for the robot to walk around a rectangular area surrounded

Write an algorithm for the robot to walk around a rectangular area surrounded by a wall and paint over the corner cells. The size of the area is unknown.

We paint over the first cell, then move to the right side along the upper border, while it is free there. If you hit the wall, it means that you have reached the corner cage. It must be painted over and continued in the same way with movement down, to the left and up.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.