#include #include #include int main(){ int a; std::string s; std::cin >> a >> s; std::stack st; std::vector v(a); for(int i = 0; i < a; i++){ if(s[i] == '(') st.push(i); else{ v[st.top()] = i; v[i] = st.top(); st.pop(); } } for(int i = 0; i < a; i++){ std::cout << v[i] + 1 << std::endl; } }