A matched string is a sequence of and characters that a
     A matched string is a sequence of {, ), {, } [, and] characters that are properly matched For example, \"{{()[]}}\"is a matched string, but this \"{{()]}\" is not, since the second is matched with a Show how to use a stack so that, given a string of length n, you can determine if it is a matched string in O(n) time.![A matched string is a sequence of {, ), {, } [, and] characters that are properly matched For example, \  A matched string is a sequence of {, ), {, } [, and] characters that are properly matched For example, \](/WebImages/38/a-matched-string-is-a-sequence-of-and-characters-that-a-1114470-1761591677-0.webp) 
  
  Solution
this algoritham have time complexity as well as auxilary complexity with O(n).
1) Declare a character stack S.
 2)(start from 1st element or 1st character of expression)Now traverse the expression string expression.
a) If the current character or first starting character is a starting bracket (‘(‘ or ‘{‘ or ‘[‘) then push it to stack.
 b) If the current character is a closing bracket (‘)’ or ‘}’ or ‘]’) then pop from stack and if the popped character is the matching starting bracket then fine else parenthesis are not balanced.(than it will return true and print expression matched)
 3) After traversing all the expression and there is any element in stack it will return false and means \"no match found\"
![A matched string is a sequence of {, ), {, } [, and] characters that are properly matched For example, \  A matched string is a sequence of {, ), {, } [, and] characters that are properly matched For example, \](/WebImages/38/a-matched-string-is-a-sequence-of-and-characters-that-a-1114470-1761591677-0.webp)
