A. Treasure
#include <cstdio>
#include <cstring>
char A[110000];
int ans[110000];
int main() {
scanf("%s", A);
int len = strlen(A);
int left = 0, right = 0, q = 0;
for (int i = 0; i < len; i++) {
if (A[i] == '(') left++;
if (A[i] == ')') right++;
}
if (right >= left) { printf("-1\n");return 0;}
right = left - right;
int flag = len-1;
for (int i = len-1; i >= 0; i--)
if (A[i] == '#') {flag = i;break;}
for (int i = 0; i < flag; i++)
if (A[i] == '#') {A[i] = ')'; ans[q++] = 1; right--;}
ans[q++] = right;
if (right <= 0) {puts("-1"); return 0;}
left = right = 0;
for (int i = 0; i < flag; i++) {
if (A[i] == '(') left++;
if (A[i] == ')') right++;
if (left < right) { puts("-1"); return 0;}
}
right += ans[q-1];
if (left < right) { puts("-1"); return 0;}
for (int i = flag+1; i < len; i++) {
if (A[i] == '(') left++;
if (A[i] == ')') right++;
if (left < right) { puts("-1"); return 0;}
}
for (int i = 0; i < q; i++)
printf("%d\n", ans[i]);
return 0;
}