text_plain_output_1.png
str1 = input('Please Enter your Own String : ')
total = 1
for i in range(len(str1)):
    if str1[i] == ' ' or str1 == '\n' or str1 == '\t':
        total = total + 1

class py_solution:
    def is_valid_parenthese(self, str1):
        stack, pchar = ([], {'(': ')', '{': '}', '[': ']'})
        for parenthese in str1:
            if parenthese in pchar:
                stack.append(parenthese)
            elif len(stack) == 0 or pchar[stack.pop()] != parenthese:
                return False
        return len(stack) == 0
print(py_solution().is_valid_parenthese('(){}[]'))
print(py_solution().is_valid_parenthese('()[{)}'))
print(py_solution().is_valid_parenthese('()'))