#include <bits/stdc++.h>   using namespace std;   int main() {     stack<int> q;     string str;     cin >> str;     int open = 0, count = 0, rcount = 0;     for (int i = 0; i < str.length(); ++i) {       if (str[i] ==  ( )         open++;       else if (str[i] ==  ) ) {         if (open != 0)           open--;         else           count--;       }       if (str[i] ==  # ) {         count += open - 1;         open = 0;         rcount++;       }       if (count < 0) {         cout << -1;         return 0;       }     }     if (open > 0) {       cout << -1;       return 0;     }     for (int i = 0; i < rcount - 1; i++) cout <<  1  ;     cout << count + 1;     return 0;   }   