Problem: Write a program that reads in a sequence of characters, and determines whether its parentheses, braces, and curly braces are "balanced". Your program should read one line of input containing what is supposed to be a properly formed expression in algebra and tells whether it is in fact legal. The expression could have several sets of grouping symbols of various kinds, () and and {}. Your program needs to make sure that these grouping symbols match up properly. Analyse the efficiency of your implementation and provide a detail discussion of its time and space complexity.