I need to do the following question:
Turn a line of input containing matching pairs of round (()) or curly ({}) brackets into a mountain range. The height of the mountain should indicate how deeply nested the brackets are.
For example, given this input:
{({(){}()}{(){}()})({(){}()}{(){}()})({(){}()}{(){}()})}
Your program should output:
(){}() (){}() (){}() (){}() (){}() (){}()
{ }{ } { }{ } { }{ }
( )( )( )
{ }
If the brackets are not balanced (that is, a matching bracket appears when some of the brackets in the middle have not been closed), the program should print 'Invalid input!'.
please help!