Ok so now you have a path. In this case it is "LBLLBSR", but how does the robot change that into the correct path? Well lets take a look at what the correct path would be. Look at the photos for the correct path.
Final correct path = SRR
So we need our path to go from LBLLBSR to the right path that is SRR. To start off we look at where we went wrong. A "B" indicates the robot turned around meaning it went down the wrong path. To optimize the path we have to get rid of the "B" by using some substitution.