The while conditional should read like"is the first closing tag less chars from beginning than an open tag?" (looks like: '<>SPACE')AND "is the first opening tag more chars after the next closing tag?" (looks like: 'SPACE<>')