CF380C Sereja and Brackets
Description
Sereja has a bracket sequence $ s_{1},s_{2},...,s_{n} $ , or, in other words, a string $ s $ of length $ n $ , consisting of characters "(" and ")".
Sereja needs to answer $ m $ queries, each of them is described by two integers $ l_{i},r_{i} $ $ (1
Input Format
The first line contains a sequence of characters $ s_{1},s_{2},...,s_{n} $ $ (1
Output Format
Print the answer to each question on a single line. Print the answers in the order they go in the input.
Explanation/Hint
A subsequence of length $ |x| $ of string $ s=s_{1}s_{2}...\ s_{|s|} $ (where $ |s| $ is the length of string $ s $ ) is string $ x=s_{k1}s_{k2}...\ s_{k|x|} $ $ (1