Algorithm for Checking anbn Form
Start at leftmost aReplace with symbol x
Travel right to find leftmost bReplace with symbol y
Travel left to leftmost aReplace with symbol x
Terminate if you encounter a o. Upon termination, direction of movement and whether you are searching for an a or a b determines if string is of the form anbn.