868. Minimize String's Cost
0
Medium
Given a string s consisting of lowercase English characters, '(' and ')', your task is to remove parentheses in any positions to make the resulting string valid. The cost of a string is defined as the total number of deletions required to make it valid. Minimize the cost of the string.
Input Format
The first line contains a string s.
Output Format
An integer representing the cost of the string.
Example
Input
Codin(g(Bl)o)cks)
Output
1
Constraints
1 <= s.length <= 10^4
Loading...
View Submissions
Console