# Bracket Number

Easy
0/40
Average time to solve is 15m
Contributed by

## Problem statement

Given a string ‘S’ comprising of some brackets. You need to print the number of every bracket.

For Example:
``````If S = (pq)()
Then the output will be 1 1 2 2. First pair of opening and closing brackets will get the same number and so does the 2nd pair.
``````
Detailed explanation ( Input/output format, Notes, Images )
Constraints:
``````1 <= T <= 50
1 <= |S| <= 10^5

Where ‘|S|’ is the length of a particular string.

Time Limit: 1 Sec
``````
##### Sample Input 1:
``````2
ab(cd)(e)
(zyz)
``````
##### Sample Output 1:
``````1 1 2 2
1 1
``````
##### Explanation For Sample Input 1:
``````Test Case 1: In the given string, there are two pairs of brackets and the order is 1 1 2 2.

Test Case 2: There is only one pair of brackets. So the number of brackets is 1 1.
``````
##### Sample Input 2:
``````2
(())()
a(b(pq)(t))
``````
##### Sample Output 2
``````1 2 2 1 3 3
1 2 2 3 3 1
``````
##### Explanation For Sample Input 2:
``````Test Case 1: In the given string, there are three pairs of brackets and the order is 1 2 2 1 3 3.

Test Case 2: In the given string, there are three pairs of brackets and the order is 1 2 2 3 3 1.
``````
Console