in reply to What?? delete chars.

Really resists answering the homework problem!....

Hi there! Attempting code and showing code is a good start to request help. On this site you will find many of the monks will not answer homework problems. Others will guide you to your answer.

Considerations.

As queue and grantm stated. use strict and warnings!

Has your class looked into regular expressions? If so that would be much easier on removing the brackets.

Reread the last command

Make LIBERAL use of print statements when you are first learning. You can see what is going on. Eventually you will learn about the debugger.