HDU - 5479
Description
Given a parentheses sequence consist of '(' and ')', a modify can filp a parentheses, changing '(' to ')' or ')' to '('.
If we want every not empty <b>substring</b> of this parentheses sequence not to be "paren-matching", how many times at least to modify this parentheses sequence? For example, "()","(())","()()" are "paren-matching" strings, but "((", ")(", "((()" are not. Input
The first line of the input is a integer
, meaning that there are
test cases.
Every test cases contains a parentheses sequence only consists of '(' and ')'. . Output
For every test case output the least number of modification.
Sample Input
Sample Output
Source
BestCoder Round #57 (div.2)
//题意:
给你一串字符串,问有几对括号
直接栈模拟就行了
|
HDU - 5479 Scaena Felix (栈模拟)水
最新推荐文章于 2020-11-10 15:45:43 发布