By braces do you mean [ { ( ???
Your "assignment" is so vague...
Do braces close between lines such as...
or just on each line..?
If anything is remotley similar your going to want to use a stack...
Everytime you find an open brace put it on the stack
if you find a closing brace. Make sure it matches the brace type, [ { (, if it does pop the top of the stack off. By doing this if you encounter a brace that does not match or reach the end of the file / line depending on the problem you know you have an error!
Example
given "[Lol is some text[fun]]"
Stack goes adds a [ stack is now "["
It skips over non-brace characters it finds another [ adds it to the stack. stack is now "[[" It continues skipping over more non brace characters. It finds a ] so it compares it to the top of the stack "[" they are the same type so it pops it off. Stack is now "[" it finds another ] it matches the top of the stack. So it pops it off. Stack is now " ". End of file...Text is fine!
given "[LOL some text..again [heh]"
Stack finds a [ adds it. Stack is now "[". Continues skipping non-brace characters. It finds another [. Adds it to the stack. Stack is now "[[" it continues skipping non-braces. it finds a ]. It matches the type of the top of the stack. Top of stack is removed. Stack is now "[". End of file/line. The stack is left with "[" there is an error.
Hope this helps....