Module: Stack practice


Problem

5 /5


mathematical expression

Problem

Write a program that checks for correct parentheses in a mathematical expression. Brackets of the same type are used: ( ). An expression can have multiple levels of nesting.

Input
The input is a character string representing an arithmetic expression.

Imprint
If the brackets are placed correctly, then display the word Yes, otherwise - No and the number of incorrectly placed brackets (a bracket is considered incorrectly placed if it does not have a pair) .

 
Examples
# Input Output
1 7-((X*((X+Y)/(J-3))+Y)/(4-2.5)) Yes
2 (a-c/(d) No. Incorrect brackets = 1