Comeet interview question

Write a code for finding properly closed brackets.